Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Reboot after stackscript
PostPosted: Fri Mar 16, 2012 11:33 am 
Offline
Newbie

Joined: Fri Mar 16, 2012 11:26 am
Posts: 3
I have a python script that launches Linodes using the API and StackScripts. Since I'm adding a private IP to the linodes, they need to be rebooted to work properly. I can't seem to reboot my linodes through the stackscript though.

I tried the subshell solution listed on this forum but it didn't work for me. The stackscript completes fine and then just drops to a prompt. I have a feeling the completed stackscript is also killing off the restart process that's been backgrounded.

Is anyone able to successfully able to reboot from their stackscripts without having the script run over again?

Thanks for the help.


Top
   
 Post subject:
PostPosted: Fri Mar 16, 2012 11:48 am 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
Hello .. hmm ... you need to allow the the StackScript to exit so its parent can clean up. You can either cron, or fork a script that waits and then issues a reboot to achieve this. I've done it, plenty of others have too.

Why not make the call to add the private IP before booting? No rebooting necessary that way.

-Chris


Top
   
 Post subject:
PostPosted: Fri Mar 16, 2012 1:11 pm 
Offline
Newbie

Joined: Fri Mar 16, 2012 11:26 am
Posts: 3
Thanks, Chris. I was thinking that I'd either cron or touch a file to indicate on restart that the stackscript should just exit the second time around. That just seemed "sloppier" to me so I figured I was doing something wrong. Can you point me to an example of forking the script. I thought that's what the (command) & syntax was doing in the page I linked and that didn't work. The script finishes OK but doesn't reboot.

I'll look into adding the IP first. If that saves me a reboot, it's a good solution.


Top
   
 Post subject:
PostPosted: Fri Mar 16, 2012 1:25 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Try adding this to the end of your stack script
Code:
$(shutdown -r +1) &

_________________
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
   
 Post subject:
PostPosted: Fri Mar 16, 2012 3:11 pm 
Offline
Newbie

Joined: Fri Mar 16, 2012 11:26 am
Posts: 3
Thanks, obs. I'll give that a shot.

Turns out I was adding the private IP before boot OK. But I was using "service networking restart" which doesn't work on the Ubuntu boxes I'm creating. I changed it to use "/etc/init.d/networking restart", which complains but seems to actually bring up my aliases.

Off to test. Thanks for the advice.


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


Who is online

Users browsing this forum: No registered users and 2 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