differnce between working of at and crontab commands


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers differnce between working of at and crontab commands
# 1  
Old 05-03-2005
Data differnce between working of at and crontab commands

h I would like to know the differnce (both working and how) between at command and crontab..

Thanks in advance
Satish D
# 2  
Old 05-04-2005
at is usually for non-regular, one-time-only jobs while cron is usually for regular, perpetual jobs ...

at samples:
Code:
# harass the console user at 7:05 pm
at 1905
echo "This is my console!" > /dev/console
# reboot the box 1 hour from now
at now + 1 hour
sync; sync; reboot

cron samples:
Code:
# reboot host every weekday @ 8:30 pm
30 20 * * 0-5 (sync; sync; init 6) > /dev/null 2>&1
# annoy the console user every weekday @ 8:00 am
00 08 * * 0-5 echo "This is my concole!" > /dev/console

however, you can also get a job to go regularly with an at command by adding something like this in your script ...
Code:
at now + 1 week << GO
/path/to/this/script > /dev/null 2>&1
GO

... and a "one-time" job in cron ... (will only run when all time conditions are met) ...
Code:
# run the job at 1:01 am Monday, January 1
01 01 01 01 1 echo "This is my console!" > /dev/console

btw, it would be best if you get into checking the man pages while you're just starting ... see "man at" and "man crontab" ...
# 3  
Old 05-04-2005
Quote:
Originally Posted by Just Ice
at is usually for non-regular, one-time-only jobs while cron is usually for regular, perpetual jobs ...

at samples:
Code:
# harass the console user at 7:05 pm
at 1905
echo "This is my console!" > /dev/console
# reboot the box 1 hour from now
at now + 1 hour
sync; sync; reboot

cron samples:
Code:
# reboot host every weekday @ 8:30 pm
30 20 * * 0-5 (sync; sync; init 6) > /dev/null 2>&1
# annoy the console user every weekday @ 8:00 am
00 08 * * 0-5 echo "This is my concole!" > /dev/console

however, you can also get a job to go regularly with an at command by adding something like this in your script ...
Code:
at now + 1 week << GO
/path/to/this/script > /dev/null 2>&1
GO

... and a "one-time" job in cron ... (will only run when all time conditions are met) ...
Code:
# run the job at 1:01 am Monday, January 1
01 01 01 01 1 echo "This is my console!" > /dev/console

btw, it would be best if you get into checking the man pages while you're just starting ... see "man at" and "man crontab" ...

Very interesting answer. Good Job. Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Crontab is not working

Dear Friends, I have Red Hat Linux Enterprise version 6.3. running SAP and oracle. I have created one crontab for user orasid to execute one job periodically. But it is not executing. I have checked crontab service is running. Please help in the matter. Regards, Bhagawati Pandey (5 Replies)
Discussion started by: BPANDEY
5 Replies

2. Linux

Crontab not working

Hi, I know this is a common topic. I'm trying to launch a perl script using a contab -e entry. I've been trying diff options but nothing seems to work: My cron is running: UID PID PPID C STIME TTY TIME CMD root 3755 1 0 Nov27 ? 00:00:00 crond This... (4 Replies)
Discussion started by: krebe
4 Replies

3. UNIX for Advanced & Expert Users

Crontab not working, please help

Hi, When I set the crontab to run every minute, every hour, it works fine. * * * * * env > /tmp/env.output However I want to run it every day at 8:00 AM and it does not run. * 8 * * * env > /tmp/env.output I ran the 'date' command which says it's 8AM PST and also the 'TZ'... (0 Replies)
Discussion started by: samantha13
0 Replies

4. Solaris

crontab not working

Shell = ksh Hi all, I scheduled an automated job on my application server like below, 30 13 * * 1-5 $HOME/my_script.sh However the script was not executed as expected. Any reason that may cause this to happen? (6 Replies)
Discussion started by: isaacniu
6 Replies

5. Red Hat

crontab is not working!!

I can run manually script of ntopdump.sh but crontab can't run this script very five minutes. # crontab -l */3 * * * * root sh /root/ping.sh */5 * * * * root sh /root/ntopdump.sh # # pwd /root # ls -l total 88 -rwxrwxr-x 1 root root 1645 Jun 14 19:01 anaconda-ks.cfg drwxrwxr-x 2 root... (14 Replies)
Discussion started by: getrue
14 Replies

6. UNIX for Dummies Questions & Answers

crontab not working

Hi, I had setup crontab to execute my script every day midnight 00:00 Below are the current settings. crontab -l 0 0 * * * /apps/bin/compress.ksh_moht > /dev/null 2>&1 Should it not work? I need help fix this? (8 Replies)
Discussion started by: shifahim
8 Replies

7. AIX

crontab isn't excuting some commands

Greetings everybody, I have an IBM P520 AIX 5.3 server machine and trying to use crontab to periodically excute a script that contains a command belongs to my software (Fast/Tools SCADA software) I added the following line after using crontab -e 01 * * * * /mypath/myscript I have two... (3 Replies)
Discussion started by: ayman metwally
3 Replies

8. UNIX for Advanced & Expert Users

crontab not working

Dear all We have SunOS 5.10 Generic_127127-11 sun4u sparc SUNW,Sun-Fire-V250 i have scheduled cronjob but its not working Crontab details 15 15 * * * /d5/oratest/testdb/hotbackup_new.sh TEST247 15 15 * * * mkdir -p rajesh /d4/appltest Crontab log details > CMD: mkdir... (4 Replies)
Discussion started by: rajesh_hv
4 Replies

9. Shell Programming and Scripting

differnce between these cmds

Hi all, I would like to know the difference between these commands /usr/lib/fs/hsfs/mount -F /dev/lofi/1 /usr and mount -F hsfs /dev/lofi/1 /usr In the first case absolute path is specified and in the next the cmd with options ,whats the differnce. PS:am sorry ,coz this had been... (1 Reply)
Discussion started by: wrapster
1 Replies

10. Solaris

Hardware differnce

Hi all, I dont know if its the right place to ask it, but can someone please explaine me the differnce between sun 220R server to a sun netra 1125? any recommendation on which one is better? Dori (2 Replies)
Discussion started by: dorilevy
2 Replies
Login or Register to Ask a Question