user1951618
user1951618

Reputation: 129

CRON on synology DS214se NAS

I have problem with adding CRON rules to synology DS214se.

  1. I add line to /etc/crontab

    * * * * * root /volume1/web/gym/bin/cron/cronTabTest.php

  2. Save crontab and restart him with

    /usr/syno/sbin/synoservicectl --restart crond

  3. Restart NAS box.

  4. After restart command line is in /etc/crontab but doesnt work.

What im doing wrong? Please help me.

This is cronTabTest.php:

    <?php

$file = 'test.txt';
file_put_contents($file, date('Y-m-d H:i:s').' ',FILE_APPEND);
echo 'cron';

?>

Upvotes: 1

Views: 1701

Answers (1)

baao
baao

Reputation: 73251

First your cron line is missing php at the beginning. Change the line

* * * * * root /volume1/web/gym/bin/cron/cronTabTest.php

to

* * * * * root /usr/bin/php /volume1/web/gym/bin/cron/cronTabTest.php

Second, when working on the cli, you will need to make sure to provide the full path from your server's root for all your files you are calling. For example:

$file = '/volume1/web/gym/bin/cron/test.txt';
file_put_contents($file, date('Y-m-d H:i:s').' ',FILE_APPEND);
echo 'cron';

Upvotes: 1

Related Questions