Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-17-2015, 11:08 PM
|
#1
|
LQ Newbie
Registered: Jun 2015
Posts: 7
Rep: 
|
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
|
|
|
06-18-2015, 04:35 PM
|
#2
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep: 
|
Every 3 hours? I think not!
but ok.
have a look at http://www.dataphyx.com/cronsandbox/cronsandboxgui.php and enter
there and hit the run button for what it will "do" and when.
|
|
|
06-19-2015, 12:03 AM
|
#3
|
LQ Newbie
Registered: Jun 2015
Posts: 7
Original Poster
Rep: 
|
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?
|
|
|
06-15-2017, 02:46 PM
|
#4
|
LQ Newbie
Registered: Jun 2017
Posts: 5
Rep: 
|
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.
|
|
|
06-15-2017, 09:30 PM
|
#5
|
LQ Newbie
Registered: Jun 2017
Posts: 5
Rep: 
|
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.
|
|
|
06-16-2017, 04:50 PM
|
#6
|
Senior Member
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Linux Mint 22
Posts: 1,227
|
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.
|
|
|
06-16-2017, 05:51 PM
|
#7
|
LQ Newbie
Registered: Jun 2017
Posts: 5
Rep: 
|
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.
|
|
|
06-16-2017, 05:54 PM
|
#8
|
LQ Veteran
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.5
Posts: 5,876
|
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.
|
|
|
06-16-2017, 08:12 PM
|
#9
|
LQ Newbie
Registered: Jun 2017
Posts: 5
Rep: 
|
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
Last edited by SP3NGL3R; 06-16-2017 at 09:15 PM.
Reason: added new script for bouncing SMB Daemon, and VPN connection
|
|
|
06-17-2017, 02:48 PM
|
#10
|
Senior Member
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Linux Mint 22
Posts: 1,227
|
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.
|
|
|
06-18-2017, 10:56 PM
|
#11
|
LQ Newbie
Registered: Jun 2017
Posts: 5
Rep: 
|
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:02 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|