Next is, I have shell scripts for all the files I want looped infinitely for specific intervals(This is for a wmii config). My question here is how can I run multiple scripts at a 10 second interval for instance?
Thanks, from what I gathered crontab only works as low as minute increments. I found what I was looking for when searching for seconds. Regardless, it is nice to learn something new(crontab). Thank you!
First I would caution against spawning scripts multiple times every 10 seconds without some error handling. With that said you can used something like this...
# # loop until ctrl+c is executed
while true; do
# # check to see if script is already running
script1_cnt=$(ps -ef | grep -v grep | grep -c script1.sh)
# # if the script is not already running execute it
if (( $script1_cnt == 0 )); then
./script1.sh &
fi
script2_cnt=$(ps -ef | grep -v grep | grep -c script2.sh)
if (( $script2_cnt == 0 )); then
./script2.sh &
fi
script3_cnt=$(ps -ef | grep -v grep | grep -c script3.sh)
if (( $script3_cnt == 0 )); then
./script3.sh &
fi
# # wait 10 seconds and do it all again
sleep 10
done