Cron is well-known time-based task scheduler. Whenever you want to execute tasks at a given time, cron is doing the job. The name cron is derived from χρόνος, the Greek word for time. NoTouch includes a cron solution that can be configured easily from the regular NoTouch configuration mechanism.
Note about terminology: While "cron" designates the overall solution, the background process is called crond ("cron daemon" - daemon is a well-known term for background services in the UNIX/Linux world). The crontab file defines the actual tasks to be done and when it should happen. In NoTouch, you do not have to write a crontab file on your own. You simply define tasks (albeit in crontab syntax) and NoTouch will generate the crontab for you.
For cron to be most effective, the system's time and time zone should be set correctly: Time
Cron parameters
The cron configuration is found under Services / Crond. In NoTouch Center, it is simply part of the "Services" tab.
Cron has just one parameter:
- Start crond. This is the master switch for the cron functionality. By default it is off - for your cron tasks to become active you need to switch this to on. Please note that a reboot is required for the service to become active.
Cron tasks
A cron task definition simply is a character string in a specific syntax. Multiple cron tasks can be created. In NoTouch Center, you would simply create a comma separated list.
An example cron job can be seen here - it would powerdown the NoTouch machine every day at 8:00pm (=20:00 in 24-hour-time):
0 20 * * * /bin/poweroff
Formally, we can describe it like this:
minute hour day_of_month month day_of_week command to execute
Obviously, minute will be a number between 0 and 59, month will be a number between 1 and 12. The hour is given in 24-hour time, thus 0 to 23. The day of month ranges from 1 to 31, the day of week ranges from 0 (Sunday) to 6 (Saturday). The asterisk symbol * denotes execute "everytime" or "ignore this".
The command to execute is a Linux shell command. Even though standard cron implementation allow Bourne-style shell syntax, we recommend to only do simple calls to executables (you may of course write your own complex shell script if you like to).
Examples:
- Every Monday at 3 am: 0 3 * * 1
- Every hour at the 20th minute, 0:20, 1:20, 2:20 etc, every day: 20 * * * *
- First of month, 1:30pm: 30 13 1 * *
- Every minute: * * * * * (use with caution)