Search

How to Modify Crontab file?

*
crontab -e This will open the crontab file and let you edit it. By default this file will be opened with the VI editor and you will need to press the ―Insert‖ key on your keyboard to be able to write in that file. *

 30 13 * * * /home/your_username/run-me.sh >/dev/null 2>&1

The first character you see is ―30‖ this means that crontab will run the script every time the clock hits the 30 minutes mark. Next ―13‖ this means that crontab will run the script when the clock hits 13. The next three * tell crontab to run the script every day, of every month of every weekday. Combining these fields crontab will run the script every day at exactly 13:30. You may notice that we added the ―>/dev/null 2>&1‖ string at the end of the command. The default cron job will always send and e-mail to the root account when ever a command is executed. Now you don‘t want to be notified every day that your crontab job has been executed. If you don‘t want to receive e-mails every day notifying you about your job‘s execution place this ―>/dev/null 2>&1‖ at the end of every instance of every crontab command.

When you are finished adding your commands to the crontab file you need to save and exit. If you are using VI as your editor you need to issue the following commands:

* Press the Esc (Escape key) on your keyboard to enter the command mode of VI *

After you pressed Escape then type the following characters :wq! and press Enter. Remember you have to type this characters (remove the quotes): ―:wq!‖.