[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scripts running all the time?



Daniel Dalton wrote:

My /home/daniel/bash-scripts/hpodder just contains the line
echo "hello world"

cron runs stuff without a tty and simply mails the output to the user. If you don't have local delivery setup properly, you won't get the mail. Instead of just "echo hello world", put "echo hello world > /tmp/file"

For stopping, the method suggested by Doug works well, or you can try the timeout command (see the other posts in this thread)

My crontab has a simple entry

* * * * * /home/rajkiran/cron/cron.minute

The cron.minute script in turn executes all scripts in my ~/cron directory that end in the current time. I start my downloads at 2AM and stop them at 8AM (that time period corresponds to unlimited usage for my ISP). So I have two files dlstart.0200 and dlstop.0800 that start and stop downloads respectively.

Here is my cron.minute, modify to your needs:
=====
#!/bin/bash
CRON_DIR=~/cron

suffix=`date +%H%M`
cd $CRON_DIR
for job in *.$suffix
do
	if [ -x $job ]
	then ./$job
	elif [ -r $job ]
	then /bin/bash $job
	fi
done
=====

--
Raj Kiran Grandhi
--
At the source of every error which is blamed on the computer, you will find at least two human errors, including the error of blaming it on the computer.


Reply to: