Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Schedule a cronjob on ssh with command line

Tags:

ssh

cron

I am using the amazonaws es3 server.I want to schedule my cron with command line. I am using the this command for scheduling the cron job

at -f shellscript.sh -v 18:30

but it will schedule for only one time i want to configure manually like once a day or every five minutes .

Please help with command which command i have to used

Thnaks,

like image 363
gaurav Avatar asked Dec 07 '11 08:12

gaurav


People also ask

How do I schedule a cron job in putty?

Creating a Cron Job First, open the Terminal (if using Linux) or Putty (if using Windows). Next, login with your SSH username & password that we sent to you. This will open a file for you where you will be able to add the Cron Job you would like to run.

How do I schedule a cron job in Linux?

9.To schedule a Cron job beginning of every month using @monthly It is as similar as the @yearly as above. But executes the command monthly once using @monthly cron keyword. This will execute the shell script tape-backup at 00:00 on 1st of every month.


2 Answers

As @The.Anti.9 noted, this kind of question fits in Serverfault. To answer your question, crontab is a little more powerful than 'at' and gives you more flexibility as you can run the job repeatedly for instance daily, weekly, monthly.

For instance for your example, if you need to run the script every day at 18:30 you'd do this,

$ crontab -e

then add the following

30 18 * * * /path/to/your/script.sh

save and you are done.

Note: 30 18 indicates time 18:30, and *s indicate that it should run every day of every month) If you need to run it on a particular day of the month just check it out on the man page of crontab.

like image 126
Kibet Yegon Avatar answered Oct 24 '22 20:10

Kibet Yegon


Doesn't crontab -e work? and to generate crontab code http://www.openjs.com/scripts/jslibrary/demos/crontab.php should help.

like image 44
Nitesh Avatar answered Oct 24 '22 20:10

Nitesh