Posts

Showing posts with the label crontab

Using crontab to startup service

Using crontab to startup service Did you know that crontab service has the "@reboot" schedule that would start a script during your system startup time? This is handy if you want something to run right after your system has stared. Try this: # crontab -e @reboot $HOME/crontab/runcmd.sh /apps/start-myapp.sh The disadvantage of this vs the rc.d scripts are you do not have control on when the system shutdown("stop") state. So if your app doenst need to clean up during shutdown, but only care to start when during reboot, this would be an easy option. download  file  now

Using Crontab in Ubuntu

Using Crontab in Ubuntu Crontab can run scripts at regular intervals and perform various tasks. Those intervals can be from 1 minute to 1 year, repeatedly. To list current crontabs: sudo crontab -l You can create a crontab file by entering the following terminal command: sudo crontab -e A crontab file has six fields for specifying minute, hour, day of month, month, day of week and the command to be run at that interval: * * * * * command to be executed - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +------- month (1 - 12) | | +--------- day of month (1 - 31) | +----------- hour (0 - 23) +------------- min (0 - 59) Some examples: * * * * * #Runs every minute */5 * * * * #Runs at every 5 minutes 30 * * * * #Runs at 30 minutes past the hour 45 6 * * * #Runs at 6:45 am every day 45 18 * * * #Runs at 6:45 pm every day 00 1 * * 0 #Runs at 1:00 am every Sunday 00 1 * * 7 #Runs at 1:00 am every Sunday 00 1 * * Sun #Runs at 1:00 am every Sunday 30 8 1 * * #Runs...