How to setup a cron job on a Linux server? I’ve designed a smal PHP aplication that administers my DHCP server and I neded to add a cron job so a script would remove computers from my MAC filtering enabled DHCP. I just set a cron job in seconds using crontab and now I don’t need to worry about removing computer from my DHCP.

It’s better if done as ROOT so after you open the shell commandline you can either use SUDO or change user by using SU (it will ask you for the ROOT user password) depending on your Linux distribution. I did mine on a Debian based distro so I’ll use SUDO for this.

1 – Open Shell Commandline
2 – type sudo crontab -e to add a new cron job
3 – add the cron job details

# Use the hash sign to prefix a comment
# +—————- minute (0 – 59)
# | +————- hour (0 – 23)
# | | +———- day of month (1 – 31)
# | | | +——- month (1 – 12)
# | | | | +—- day of week (0 – 7) (Sunday=0 or 7)
# | | | | |
# * * * * * command to be executed

So lets say I want to add a cron job that runs every day at 00:00

0 0 * * * php /var/www/dhcpwebmin/clean_dhcp.php

or if I wanted to run another script at 1:05PM from April to June every Wednesday.

05 13 * 4-6 3 shell /etc/myscripts/wednesday_script.sh

4 – When finished press CTRL + o to write to the file (it will ask you to confirm by pressing ENTER)
5 – Press CTRL + x to exit

If you want to see the cheap brand cialis overnight shipping list of cron jobs just type on the commandline SUDO contab -l

One Reply to “Linux CRONTAB – Adding a Linux cron job”

  1. Pingback: Linux Commands

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.