Need help with a scheduled reboot cron job via Webmin
Greetings
I am quite new with Linux. I have recently built a home Ubuntu server (14.04). I am wanting to schedule a daily reboot of the server at a specific time. I have Webmin installed so assuming it should be a bit easier to do this task via Webmin. My understanding is to do this via Webmin, I would create a new scheduled cron job, however I am having some difficulty determining what I enter for the cron job. I assume that I would execute the cron job as the a user with root privileges. In the Command box, would I simply enter reboot or would it be 0 */3 * * * /sbin/reboot Also, do I need to enter anything in the Input to command box? Thanks for any help on this Cheers, Torbuck |
Every 3 hours? I think not!
but ok. have a look at http://www.dataphyx.com/cronsandbox/cronsandboxgui.php and enter Code:
0 */3 * * * |
I wasn't sure what "0 */3 * * * /sbin/reboot" actually represented. I found that in a Google search. Someone else was trying to do the same thing. I only want the system to reboot once a day, say at 7am. I can see that I can control the reboot time via Webmin. I assume under "Hours" I would just select 7, although I am a bit confused how to set the time.
So back to my original question, is the only entry that I need to place into the Command box is "reboot"? Or is there more to it than that? |
Here's my setting for HOURLY (on the hour)
Execute as: root
Active: Yes Command: /sbin/shutdown -r now Input to Command: <blank> Description: HOURLY reboot I just played with running it every 2 hours by selecting 0,2,4,..,22 under the "Selected Hours", but it would run on reboot. I think this might be a bug in the way it triggers the Cron Job. So I've adjusted it to only have the value '2' selected under hours. I'm hoping this will bounce in about 90 minutes on it's own. I think you want: When to execute: Daily (at midnight) ... not 7am, but at least it's clear. |
no clue
Every time I use any of the Webmin options other than the built in "hourly / weekly / etc" they all execute on reboot. and when that script is a reboot script? ... you guessed it. Luckily there's a little lag and I was able to get in and disable the reboot before the turn of of the minute. Very frustrating.
|
If I may, automatic reboots are not the best idea. Maybe it was a fluke but I had my server on cronjob reboots once a week, one day it rebooted at 12am sunday morning, i didnt find out till 730pm that day that it had crashed and hadn't rebooted properly. Everyone on the property was without internet all day because of that. You don't need to do it daily, but it should be done manually to make sure it all comes back up properly. my 2 cents.
|
I was doing it hourly because my SMB shares from it kept dying. They seem to have stabilized, and for me it's just a hobby rPi that lives on VPN for random torrents. Truthfully. Almost never used. But I agree with you if it's an important Linux box.
|
One of the main reasons to use linux servers is because they don't have to be rebooted periodically. I've seen public servers run for two years uptime and that ended only because of a power and UPS failure.
|
Now that I think about it. I should've scheduled the Samba service to recycle. HRM. Damn it. Now that I know more I'll change it. Maybe even write a little monitoring script that bounces the service if needed.
[edit] added an hourly samba bounce. I wasn't able to use "restart" if the service was stopped for some reason. Maybe the SH for 'restart' isn't a stop/start, or doesn't handle errors well. So I compounded it with a stop/start myself which works. Run-As: root Command: service smbd stop; service smbd start Schedule: hourly [edit2] Did the same for my VPN (I'm researching how to monitor this to auto bounce when needed) too. Command: nmcli con up My_VPN_Connection_Name_NOT_ID -----ex: nmcli con up ExpressVPN |
I'd be more inclined to find out why they are dying. That is not normal behavior by any stretch of the imagination. Something else is going on, have you checked out the logs? I reboot my server once every 2 weeks, only because I feel I should. But I haven't had a single process or service just randomly stop yet. Been running fine for a couple years now, including my samba service.
|
I checked with my VPN provider and the short answer is that they drop idle connections. They don't offer an "always on" solution. So it's up to me to keep it alive. I've considered just running an IP Trace (dig) every couple minutes just to keep it up. But haven't implemented yet.
|
All times are GMT -5. The time now is 08:21 AM. |