Problem / Outcome Summary
- This article will show you how to make changes to crontab on a QNAP NAS and have them kept after a reboot
- Please see the ‘Summary Overview’ tab below for a high level view of the objectives this ‘howto’ will achieve.
Why might I want to do this?
- If you want to add a scheduled task to your QNAP NAS, you would undoubtedly want to know that it saves permanently
- The normal method for saving your crontab does not work on a QNAP NAS after it is rebooted
To be clear, what does Crontab do?
Simply put, crontab is a process that runs on *nix based systems (that’s Unix, Linux, BSD etc) and schedules programs to run on preset schedules. Common types of things ‘triggered’ by the crontab process are backups, email server tasks, log rotations and database maintenance.
How does Crontab work?
Crontab works by processing a list in a textfile (the crontab file), in order and processing it as per your configuration. In that configuration, you point it at other programs or files and say to them to run at your configured schedule.
An example of a line in crontab is shown below:
30 20 * * * rm /home/someuser/tmp/*
There are plenty of detailed examples on how crontab works on the internet such as this at adminschoice.com which will explain the format of the above crontab line.
So how do I make the changes stick after a reboot?
This is really, really simple.
- Edit your crontab file eg: vi /etc/config/crontab
- Make crontab see the changes: crontab /etc/config/crontab
- Restart the crontab service: /etc/init.d/crond.sh restart