Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Aug 26, 2013 9:19 pm 
Offline
Senior Newbie

Joined: Mon Aug 26, 2013 9:02 pm
Posts: 14
I have a CentOS 6 machine that's hosting some non-critical Web applications.

I need it to be up in general, but a weekly late-night reboot won't cause any major business problems.

In order to keep the system up to date I put this in root's crontab...

Code:
6 3 * * * /usr/bin/yum update -y 2>&1 > /home/my_account/log/yum_update.log


So I'm running yum update -y daily there.

My main question -->

Sometimes an update requires a restart.

So to deal with that, I'd like to somehow set up this machine to reboot itself once per week.

What's a good way to do that?


(I considered adding a weekly cron job to run shutdown -r now, but I'm not sure if that would work well with a VPS machine.)

I understand many sysadmins would not consider this whole setup in general to be acceptable for a production system.

But I'm just hosting some personal apps and utils here. If an update goes awry and I need to restore from backup, it's ok.

My goal here is to keep this system patched and secure without costing too much of my time and attention which I need for other priorities that actually are critical.

In case it matters, I'll be running Apache, MySQL, and sshd.

Any help or advice would be greatly appreciated.

Thanks!


Top
   
PostPosted: Mon Aug 26, 2013 10:01 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
As root, add to your cron job

Code:
0 1 * * 1 /sbin/shutdown -r +5


Can't really see the advantage of this, if you're going to update daily (nightly) you probably want to reboot nightly too - otherwise a update that requires a reboot done on monday, will have to wait until sunday to get rebooted (plus stacking updates that require a reboot isn't a good idea either).

Of course willy nilly updates and reboots are just oh such a bad bad idea, but you already know that.

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Tue Aug 27, 2013 12:01 am 
Offline
Senior Newbie

Joined: Mon Aug 26, 2013 9:02 pm
Posts: 14
Thanks for the response, vonskippy.

Yeah, it isn't the greatest. Maybe I'll try to work out a better strategy, like manually once a week.

Realistically though, given the risk level and time constraints involved, this may be the least bad option for this particular host.

What does the "+5" option do?


Top
   
PostPosted: Tue Aug 27, 2013 12:06 am 
Offline
Senior Newbie

Joined: Mon Aug 26, 2013 9:02 pm
Posts: 14
Oh, I see. It gives logged in users (i.e., me) a five-minute warning. Cool :)


Top
   
PostPosted: Tue Aug 27, 2013 9:23 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
Will that work on linode, or will it result in a shutdown until Lassie detects the outage and schedules a boot from the management infrastructure?

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
PostPosted: Tue Aug 27, 2013 9:47 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
sweh wrote:
Will that work on linode, or will it result in a shutdown until Lassie detects the outage and schedules a boot from the management infrastructure?


It'll result in a shutdown until Lassie boots back up.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
PostPosted: Tue Aug 27, 2013 12:21 pm 
Offline
Senior Newbie

Joined: Mon Aug 26, 2013 9:02 pm
Posts: 14
obs wrote:
sweh wrote:
Will that work on linode, or will it result in a shutdown until Lassie detects the outage and schedules a boot from the management infrastructure?


It'll result in a shutdown until Lassie boots back up.


Yeah that's what the log is showing.

I thought maybe the usual shutdown command wouldn't work on Linode, which is why I originally asked.

It there a preferable way to configure the reboot?


Top
   
PostPosted: Tue Aug 27, 2013 12:26 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Excepting kernel updates, no update on Linux should require a reboot; the files are overwritten in-place and then the service is restarted...


Top
   
PostPosted: Tue Aug 27, 2013 4:00 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
My bad for not trying it before posting.

:oops:

So "why" doesn't this work on a Linode VPS when it works on a physical server?

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Tue Aug 27, 2013 7:52 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
Eethy wrote:
It there a preferable way to configure the reboot?

Use the API? https://www.linode.com/api/linode/linode.reboot

_________________
Rgds

Stephen

(Linux user since kernel version 0.11)


Top
   
PostPosted: Tue Aug 27, 2013 7:53 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
vonskippy wrote:
So "why" doesn't this work on a Linode VPS when it works on a physical server?

I'm guessing it's something to do with how Xen is configured, but I dunno what. It does seem odd!

_________________
Rgds

Stephen

(Linux user since kernel version 0.11)


Top
   
PostPosted: Tue Aug 27, 2013 7:57 pm 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
Key Lish with your ssh key, and then issue the reboot via Lish-via-ssh:

https://library.linode.com/using-lish-t ... public-key
https://library.linode.com/using-lish-t ... ish-tricks

Code:
ssh -t [manager-username]@lish-[location].linode.com [linode-name] reboot

-Chris


Top
   
PostPosted: Wed Aug 28, 2013 9:36 am 
Offline
Senior Newbie

Joined: Mon Aug 26, 2013 9:02 pm
Posts: 14
Excellent!

Thanks for the help, guys.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: Dweeber and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group