My WD My Cloud did a firmware update this weekend (forgot to turn off auto updating) that caused some settings to reset (including @Nazar78’s hostsdeny script, login key pairs and cron jobs). Most things are recovered, but I can’t get the cron job running again.
When I run crontab -e with my root user, my WD My Cloud replies: “no crontab for root - using an empty one”. That is why I added the hostsdeny.pl script to /etc/crontab (and it seems to be running at reboot).
When I add another cronjob there (*/5 * * * * root /shares/scripts/dyndnsupdate>/dev/null 2>&1) to check if my IP changed, it doesn’t seem to run. I did a cron restart, but that didn’t help.
Alternatively I tried to add the job as a new file in /etc/cron.d called ‘my_cronjobs’ (as mentioned here), but that didn’t help too.
I can run /shares/scripts/dyndnsupdate as a command which works correctly.
It should be:
*/5 * * * * /root/shares/scripts/dyndnsupdate>/dev/null 2>&1
If it still doesn’t work try:
*/1 * * * * /bin/echo `date`>>/root/shares/scripts/test.log
See if the test.log gets updated every 1min else something is wrong with your rootfs, check if the service is running ps -ef|grep cron. A quick reflash might help.
Where should I save it? If i run crontab -e, it creates a file in a tmp dir.
Is it /var/spool/cron/crontabs/root? It is empty now. Can I just add the formatting * * * * * /path/ ?
Do you mean to install the firmware update again (and thus lose my customisations)?
When creating a new file it will place it first in the tmp dir then moved
to its final location when you exit and save. Yes you can create a new file
in the spool cron path. It’s actually the same content and format like in
the normal crontab -l you usually see. Give it the same user/group/perm I
mentioned previously.
You could also test if other users has the same cron not running issue by
creating a new cron for that user i.e. crontab -u username -e then add the
log test every minute * * * * * /usr/bin/env>>/tmp/test.log.
The final resort is to reflash, be prepared to redo all customizations.
No that I was describing how the editor treats new creation. If you want to bypass the crontab editor, save it directly to /var/spool/cron/crontabs/root.
Have you searched through the dedicated WD Pro Series subforum to see if there are any past discussions that may be relevant to your issue/question? This subforum is typically covering issues related to the single bay/single drive My Cloud units.