QUESTION Scheduled Reboot on IncrediblePBX 13-13 Raspberry Pi

mattburris

Member
Joined
Dec 22, 2017
Messages
31
Reaction score
5
So I'd like my pbx to restart every night at 4am by calling /usr/local/sbin/reboot via cron

As a test, I've set it up to reboot at 1:49pm.

I use crontab to add the following line:

49 13 * * * /bin/bash /usr/local/sbin/reboot

at 1:49pm nothing happens.

Any pointers?
 

lrosenman

Guru
Joined
Oct 17, 2014
Messages
221
Reaction score
30
what user is running that cronjob?

You need it to be root, or at least sudo without password.
 

mattburris

Member
Joined
Dec 22, 2017
Messages
31
Reaction score
5
I am ssh'd into the RPi as root when I run 'crontab -e'

Is there a way to check if any errors or logs are created when the job should run?
 

lrosenman

Guru
Joined
Oct 17, 2014
Messages
221
Reaction score
30
It should mail root with any output.

that said, check /var/log/cron for messages as well.
 

kyle95wm

Phone Genius Owner
Joined
Apr 16, 2016
Messages
520
Reaction score
90
That cronjob doesn't look right. Try this one:

Code:
49 13 * * * root reboot

This will run a cronjob as root and will issue the reboot command. If that doesn't work. let me know.
 

lrosenman

Guru
Joined
Oct 17, 2014
Messages
221
Reaction score
30
If that's in /etc/crontab that's correct, if it's in crontab -e (root's /var/spool/cron/tabs/root) his is correct
and I just noticed that the reboot command is full path'd to /usr/local/sbin/reboot which is wrong.

it's in /sbin/reboot..

so make the crontab entry:
49 13 * * * /sbin/reboot

as it's NOT a shell script....
 

mattburris

Member
Joined
Dec 22, 2017
Messages
31
Reaction score
5
I believe when I execute the 'reboot' command normally, is it running the file here: /usr/local/sbin/reboot?
It's content is
Code:
#!/bin/bash

fwconsole stop
/etc/init.d/mysql stop
/etc/init.d/apache2 stop
shutdown -r now

That particular file is the one I'd like to execute via cron to reboot the RPi.

Correct me if I'm wrong, but I was under the impression that script should be used since it is gracefully shutting down Asterisk, mysql, and apache.
 

kyle95wm

Phone Genius Owner
Joined
Apr 16, 2016
Messages
520
Reaction score
90
Does "which reboot" return the path of the file you mentioned? If so, you should be able to execute the reboot command inside of cron.
 

Members online

Forum statistics

Threads
25,812
Messages
167,764
Members
19,241
Latest member
bellabos
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top