/build/static/layout/Breadcrumb_cap_w.png

Reboot Linux Machine

I know this is a seemingly basic question, what is the proper way to execute a Linux system reboot? I'm wanting to use the K1000 scripting module to reboot our XenServer hosts.

0 Comments   [ + ] Show comments

Answers (7)

Posted by: rich0864 13 years ago
Orange Belt
0
Look into the bash command 'init', these are run levels for the kernel. Init 0 will shutdown a linux box from CLI, init 6 is what you're looking for I think.

Cheers
Rich
Posted by: pjgeutjens 13 years ago
Red Belt
0
I tend to use the shutdown (with -r for your reboot) command for the timing options, i.e

shutdown -r now
shutdown -r 08:00 // at 8am
shutdown -r +5 // in 5 minutes
shutdown -r now "message"

Rgds,

PJ
Posted by: anonymous_9363 13 years ago
Red Belt
0
Great for Windows machines, Pieter,but not a great deal of use for Linux boxes :-)

Also, you know it's my job to misread posts.
Posted by: pjgeutjens 13 years ago
Red Belt
0
Great for Windows machines, Pieter,but not a great deal of use for Linux boxes :-)

this site, and the fact that I've actually used this command on linux numerous times, beg to differ [8D]
Despite my job as Windows packager, I actually often run linux on at least one machine as main OS at home.

Re-reading the original post, I am assuming you can run the linux command directly from kbox? And you don't have to take a detour via some windows-compliant command?

PJ
Posted by: rbarth 13 years ago
Senior Yellow Belt
0
Thanks for the feedback on this. Originally I was looking at using halt, but was not clear regarding the KBOX environment variables for locations or if it's better to include a script file in the execution of the scripting task rather then using the command and parameter fields.

BTW, it's good to see some Linux feedback. When I began deploying our XenServers I was concerned that we wouldn't be able to support them with the KBOX since it's not officially supported. However, after a little trial and error getting the client loaded, it's been a great management tool for both VM hosts and guests.

Thanks again.
Posted by: rbarth 13 years ago
Senior Yellow Belt
0
Info on the shutdown command (for XenServer:Linux)

SHUTDOWN(8) Linux System Administratorâs Manual SHUTDOWN(8)

NAME
shutdown - bring the system down

SYNOPSIS
/sbin/shutdown [-t sec] [-arkhncfFHP] time [warning-message]

DESCRIPTION
shutdown brings the system down in a secure way. All logged-in users are notified
that the system is going down, and login(1) is blocked. It is possible to shut the
system down immediately or after a specified delay. All processes are first noti-
fied that the system is going down by the signal SIGTERM. This gives programs like
vi(1) the time to save the file being edited, mail and news processing programs a
chance to exit cleanly, etc. shutdown does its job by signalling the init process,
asking it to change the runlevel. Runlevel 0 is used to halt the system, runlevel
6 is used to reboot the system, and runlevel 1 is used to put to system into a
state where administrative tasks can be performed; this is the default if neither
the -h or -r flag is given to shutdown. To see which actions are taken on halt or
reboot see the appropriate entries for these runlevels in the file /etc/inittab.

OPTIONS
-a Use /etc/shutdown.allow.

-t sec Tell init(8) to wait sec seconds between sending processes the warning and
the kill signal, before changing to another runlevel.

-k Donât really shutdown; only send the warning messages to everybody.

-r Reboot after shutdown.

-h Halt or poweroff after shutdown.

-H Halt action is to halt or drop into boot monitor on systems that support it.

-P Halt action is to turn off the power.

-n [DEPRECATED] Donât call init(8) to do the shutdown but do it ourself. The
use of this option is discouraged, and its results are not always what youâd
expect.

-f Skip fsck on reboot.

-F Force fsck on reboot.

-c Cancel an already running shutdown. With this option it is of course not
possible to give the time argument, but you can enter a explanatory message
on the command line that will be sent to all users.

time When to shutdown.
Posted by: rich0864 13 years ago
Orange Belt
0
If I remember correctly Xenserver [and vm esx] is based on either a debian or a red hat kernel so essentially everything that can be run from CLI on those kernels can also be run at CLI on Xenserver. I ran a xenserver in my home lab for some time and achieved a number customisations through bash commands/scripts. 'Shutdown' definitely has more functional options than initialising a different runlevel [to be honest, I did not know 'shutdown' was a valid command to linux either], have a look here: http://www.centos.org/docs/2/rhl-rg-en-7.2/s1-init-boot-shutdown-init.html

My two cents :)
Rich
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ