How to setup and restart the cron job on a Synology NAS

Under normal circumstances, we can use the schedule app for run our script or jobs in Synology NAS, but I found that seem not works when I set the schedule for execute by every hours(or mins…), so I have to set the cron job by myself with ssh login.?

I will show you how to set the cron job by command with ssh:

Update the cron job

1. Become a root

sudo -i

2. Use vi to edit the crontab file:

vi /etc/crontab

and for this way, I will suggest to copy the crontab file to a share folder so that you can edit it in your PC (or Mac), that will be easy to edit. For example, copy to the homes share folder as below:

cp /etc/crontab /volume1/homes

after you updated it, just copy and cover the existing one:

cp /volume1/homes/crontab /etc/crontab

3. After you done, you need to restart the cron job service:

synoservice -restart crond

4. That’s all!

Cron job command

Please find below settings for how the cron job works, if you want to set it execute every 3 hours,

just set the hour column to 3 as below:

#minute	hour	mday	month	wday	who	command
0	*/3	*	*	*	root	/tmp/synoschedtask --run id=4

348 total views, 7 views today

Do you like this post?
  • Fascinated
  • Happy
  • Sad
  • Angry
  • Bored
  • Afraid

You may also like...

shares