I have a cron job to restart my FreePBX periodically. Problem is that it doesn’t reboot. I can ssh into PBX and run “shutdown - r now” and it reboots. Going through FreePBX>System Admin, I can reboot. Going through Webmin, I can select the cron job and Run Now and it reboots.
Is there something that FreePBX is controlling that would stop the cron job from running naturally?
I am using:
0 2 1 * * shutdown -r now #Reboot system Monthly
I don’t think there is anything in FreePBX preventing this command from executing. Maybe you need the full path to the shutdown command, I.E:
Regardless, you should be able to check the log in
/var/log/cron to see if the command is executing and maybe possibly get a clue as to why it is failing.
For details see man 4 crontabs
Example of job definition:
.---------------- minute (0 - 59)
| .------------- hour (0 - 23)
| | .---------- day of month (1 - 31)
| | | .------- month (1 - 12) OR jan,feb,mar,apr …
| | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| | | | |
* * * * * user-name command to be executed
0 0 * * 0 root /sbin/shutdown -r now # reboot every sunday at 00:00 am
Create script file and add this file in Crontab for week/monthly works.
My question would be why? Why does the server need to be automatically rebooted every 30 days? Because this can actually cause more issues than it solves.
Thanks for the replies, ideas and information. I don’t know that it has to periodically reboot. I think it is now becoming more of a why is it not rebooting. Log file indicates root is the user running it, but no info/error found after that entry.
Using /sbin/shutdown in testing seems to have worked. Cron log file now includes CRON Shutting down right after my scheduled shutdown.
I don’t know that I will incorporate a reboot now, @BlazeStudios . I have never heard of rebooting a computer periodically (within reason) causing issues unless a piece of hardware is failing and a reboot can’t continue with further intervention. By default setup, our Redhat ERP server reboots nightly.
In broad, sweeping generalizations, the only time you should need to reboot an Asterisk server is when something on the server is leaking memory. As another generalization, Asterisk and FreePBX are intended to run full-time, every time, and shouldn’t have to be rebooted unless there’s a change to the configuration of the system that requires it.
I’m not saying you’re wrong or that it’s a problem; I’m just saying that the vast majority of Asterisk system have up-times that are crazy long.
Great! - Thanks. I do like knowing that. That kind of stability leads me to believe this system is/was well thought out and implemented. I will disable my now-working cron job to reboot the system.
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.