What is the correct cron syntax for a scheduled reboot of MotionEyeOS?

858 views
Skip to first unread message

AdWood

unread,
Mar 26, 2019, 6:36:59 AM3/26/19
to motioneye
Hi all - can someone please let me know the correct cron syntax for a scheduled reboot of MotionEyeOS?   I'm wanting to reboot every four hours.   This is not because of a problem with MotionEyeOS (which is excellent, by the way), but because of an unreliable internet connection.

I came across the following cron command for Ubuntu, but this doesn't seem to work in MotionEyeOS, I presume because the file or folder structure is different:

    0 */4 * * * root /sbin/shutdown -r now

What should I be typing instead?

mmaypo

unread,
Apr 2, 2019, 1:02:16 AM4/2/19
to motioneye
Rebooting may not be the best way to go here. Do you notice the motioneyeos connection to the internet goes down and rebooting fixes it? More details on what specifically goes wrong, and why rebooting helps would be good.

I had an issue where nginx on my pi would stop running every couple weeks or so. Instead of rebooting on a schedule, I use a program called monit  https://www.tecmint.com/how-to-install-and-setup-monit-linux-process-and-services-monitoring-program/

monit will notice that a process has stopped or is in a bad state, and can stop, start, and restart processes, log on errror, etc. Take a look and see if it might help your situation. If you feel you must run the cron job, you want 'reboot' not 'shutdown' . options are given by running reboot --help, 

StarbaseSSD

unread,
Apr 2, 2019, 11:07:44 AM4/2/19
to motioneye
admin is the root user
the shutdown command does not exist on the motioEyeOS system.
the reboot command exists at /sbin/reboot
I have successfully tested the following:
ssh into the motionEyeOS
mount -o remount,rw,/
mount -o remount,rw /boot
crontab -e
add    0 */4 * * * /sbin/reboot
save
It should reboot every 4 hours.

StarbaseSSD

unread,
Apr 2, 2019, 11:09:47 AM4/2/19
to motioneye
Correction below in line 
mount -o remount,rw /
removed ',' following rw

On Tuesday, April 2, 2019 at 11:07:44 AM UTC-4, StarbaseSSD wrote:
admin is the root user
the shutdown command does not exist on the motioEyeOS system.
the reboot command exists at /sbin/reboot
I have successfully tested the following:
ssh into the motionEyeOS
mount -o remount,rw /
Reply all
Reply to author
Forward
0 new messages