Reboot MyCloud on a schedule

Disclaimer: This post assumes you’re comfortable with SSH’ng into your MyCloud and creating/editing files.

The info in this post doesn’t alter stock MyCloud functionality so I think it won’t void your warranty but I don’t really know.

I’m using a MyCloud as an offsite backup device.  

It connects to the office via OpenVPN (as outlined in this post). It’s been great, steadfastly reconnecting no matter what.

However:

After a couple of months, my custom OpenVPN connection stops trying to connect.

Rebooting puts things right again.

Until I solve that problem, I’m opting to reboot MyCloud on a schedule.

Scheduling a reboot is not hard to do. I just had to create a new cron job file in /etc/cron.d/

The following command will create a cron file to reboot the drive daily at 5:30a.

echo "30 5 * * * root /sbin/shutdown -r now" > /etc/cron.d/dailyreboot

The only hitch was I had to set the file permissons on the cron file to 644 before cron would run the job.

chmod 644 /etc/cron.d/dailyreboot

My other cron files run reliably with perms set to 754. I don’t know why this had to be 644.

It was another Debian user with the same issue that pointed me to the soluiton.

Thanks (for a place to post this stuff).

cron.d checks the permissions and restricts it, 7 or 5 would only be needed for files ran at the command prompt

from “man 5 crontab” on centos (not the same mut seems to apply, it state the files must not be executable or writeable by anyone except the owner, not sure why the other cronjobs work

larryg0 wrote:

cron.d checks the permissions and restricts it, 7 or 5 would only be needed for files ran at the command prompt. 

 

From “man 5 crontab” on centos

The files must not be executable or writeable by anyone except the owner, not sure why the other cronjobs work

My other cronjobs are calling scripts instead of executing commands directly.  That’s only difference I can think of.

I had set them to 754 to match the perms of the existing MyCloud job files (in /etc/cron.d/)

What if I wanted to reboot it weekly instead of daily?

I’m having the same prob with our MyCloud after several days., usually longer than a week, its accessible internally but not from the MyCloud app. As usual a reboot fixes.

Jimmy

Change the 30 5 * * * to 30 5 * * 0 for every sunday. 1 for Monday etc.

RAC

Thanks, I appreciate your help.

Jimmy

I have setup the Chron job to run on my WD device. Before changing it to a weekly I figured I’d set it up for nightly and see how it works. I checked the device today and its uptime is 3+ days. I copied it exactly as above and set permissions to 644. Any idea why it wouldn’t be working?

Jimmy

Can Someone give me instructions on how to do this
I know how to set the ssh setting in the factory interface
I just don’t know the procedure from the CL
Thank you

Followed the instructions on a MyCloud EX2 Ultra, but unfortunately, that did not work - there was no scheduled reboot.

I’m wondering if the shutdown command is the problem:

root@MyCloudEX2Ultra ~ # /sbin/shutdown -r now
-sh: /sbin/shutdown: not found

sudo reboot works, but the dailyreboot file is erased from /etc/cron.d after a reboot