To be able to schedule activities to run in intervals is a important part in the administration of a Linux system. The system that handles scheduling is called cron and makes it possible to set the interval from years to minutes. The scheduling is configured in so called crontab files which are placed in the /etc directory. An example on how to run a script every 5:th minute:
First make the script executeable using chmod +x scriptname.
Launch crontab as a local user using crontab -e.
To make the script run every 5:th minut input:
*/5 * * * * ~/path/to/scriptfile
To make a script execute every time the system boots:
- Copy the script to /etc/init.d/
- Make it executable
- Link it to startup using sudo update-rc scriptfile defaults