Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ 1 [2] 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Setting up a cron job< Next Oldest | Next Newest >
kluber Offline





Group: Members
Posts: 12
Joined: Nov. 2004
Posted: Aug. 01 2006,07:26 QUOTE

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.
Back to top
Profile PM 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Aug. 02 2006,06:47 QUOTE

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...


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
sankarv Offline





Group: Members
Posts: 190
Joined: Mar. 2006
Posted: Aug. 02 2006,07:13 QUOTE

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)


--------------
Think before you do anything...
Back to top
Profile PM 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Aug. 02 2006,07:37 QUOTE

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...


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
Zucca Offline





Group: Members
Posts: 524
Joined: Feb. 2006
Posted: Aug. 02 2006,08:36 QUOTE

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. =)


--------------
Do you have it? - http://dy.fi/mak
Back to top
Profile PM WEB ICQ MSN 
14 replies since July 15 2006,08:10 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ 1 [2] 3 >/
reply to topic new topic new poll
Quick Reply: Setting up a cron job

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code