Tag Archives: nas

How to modify crontab on QNAP NAS to add/edit jobs in cron

QNAP_Logo_

Few bullet-points on how to edit crontab and use cron to schedule jobs:

1] Edit /etc/config/crontab file and add your custom job to the scheduler. I’m scheduling backup of my MySQL databases (mysqlbackup.sh in /bin) to happen daily at 0:45 AM so the syntax will be:

45 0 * * /bin/mysqlbackup.sh

Please follow these instructions to choose custom timing:

2] Run crontab /etc/config/crontab to make cron aware of changes to crontab file.

3] Restart cron – /etc/init.d/crond.sh restart

4] Check the new crontab by using crontab -l or by cat /etc/config/crontab

/EDIT

I have just realized that in my last line when you run the .sh script you need to provide an absolute path. It should read:

/bin/sh /bin/mysqlbackup.sh

Now it will work!