Other Help Topics :: Setting up a cron job



I build a Cron extension : cron30.dsl
You can find them in the myDsl testing area, please try it and tell me if it achieve your tasks.

I read somewhere:
Quote
00 4 * * 0 root echo "This command is run at 4 am every Sunday"
* 4 * * Sun root echo "So is this"

Doesn't that last line actually occur every minute at 4 am? Like 04:XX.
If I remember correctly, crond checks every minute if it needs to run something...

Code Sample
$ sudo crond --help
sudo: crond: command not found
$ sudo crontab --help
sudo: crontab: command not found

Ok. It seems there's no cron.

I could install it, but I'd rather write simple bash script using sleep command in it...

Hi Thulemanden,
Please check the cron format u mentioned (0 1 * * * ) u said u need to run every hour.

But this format runs every day at 1'O clock.

here first parameter is minute, second is hour, third is date of month ,fourth is month, fifth is day of week.


minute (0-59)
hour (00-23)
date(1-30 or 31) (for february 28/29))
month (1-12)
day of week (0-7)

0 and 7 - sunday
1- monday
2-tuesday
3-wednesday
4-thursday
5-friday
6-saturday


If you mention * in any of the respective fields it runs all time.
the crontab file is checked each minute by cron daemon.


if u want to run every hour (XX * * * *)
where
XX-minute (0-59)



hope im right

u can edit the crontab file by


crontab -e command

-r is for remove -l is for listing the entries

you add an entry to crontab file as

00 * * * * /path/webalizer


00 * * * * nohup /path/webalizer (this will run even if you are not logged in)

There's a good howto to cron.

Here's also a simple way to set deschules without cron:
Code Sample

#!/bin/bash

while [ "forever" -eq "forever" ]
do
 sleep 1m && source /etc/simplecron/minute.run &
done

while [ "forever" -eq "forever" ]
do
 sleep 10m && source /etc/simplecron/tenminute.run &
done

while [ "forever" -eq "forever" ]
do
 sleep 1h && source /etc/simplecron/hour.run &
done

# And so on...
# Copy freely as long you don't sue me.



I haven't tested this but it should work..?

EDIT: Oh noe! It wont work at all. =D It was just an idea... Hmmm. DO NOT TRY THIS. =D

I'll write working one later...

This works.

Code Sample
#!/bin/bash

while [ "forever" == "forever" ]
do
 sleep 1m && source /etc/shcron/minute.run
done &

while [ "forever" == "forever" ]
do
 sleep 10m && source /etc/shcron/tenminute.run
done &

# Again: no copyright, no suying.
# All lawyers reserved.


Now it sources minute.run once in a minute and tenminute.run once in ten minutes.

Anyone like to enhance? Please do. =)

Next Page...
original here.