views:

42

answers:

2

I have already created a schedule task which runs weekly on some day(wed). I want to change the day and the time of the same task.

Is it Possible?

If it is not possible, then delte the current scehdule task first and recreate a new one is the solution?

A: 

If you are speaking of an at job, then you need to erase it using atrm. If you are speaking of a cron job, then you can change it as much as you want before the job is executed. It includes both its scheduling and its content.

MatthieuP
Yes I was talking about cron job.I didn't have much time so I deleted the old cron job through command line and created a new one with the correct time and day.
alice7
+1  A: 

To get a list of the the current cron jobs scheduled for the user your logged in as, type the following at your shell prompt (assuming it's, $):

crontab -l

You'll get a crontab that looks like this:

10 3 * * * /home/user/scripts/backup.sh  
15 3 * * 0 /home/user/scripts/alarm.sh

This, for example, shows that the backup.sh script will run every day at 3:10 am. The alarm.sh script will run at 3:15 am on Sunday.

The format of crontab is as follows:

.---------------- Minute (0 - 59) 
|  .------------- Hour (0 - 23)
|  |  .---------- Day of the Month (1 - 31)
|  |  |  .------- Month (1 - 12) or jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec
|  |  |  |  .---- Day of the Week (0 - 6) or sun,mon,tue,wed,thu,fri,sat 
|  |  |  |  |

*  *  *  *  *  /command/to/run

You can edit the crontab schedule by passing the -e (edit) switch:

$ crontab -e

This will drop you into the default editor and should allow you to edit the crontab as if it were any other text file. When you are done, save your changes and exit the editor. Running crontab -l again should show you your updated changes.

Jim