TechSupp Posted December 2, 2009 Posted December 2, 2009 Now I'm new to nix and only use it from a boot CD for imaging PC's, but how do I exit and powerdown nix correctly, instead of just exiting the desktop and just turning off the PC Thought I'd best learn how to do it correctly!
ZeroHour Posted December 2, 2009 Posted December 2, 2009 enter shutdown now at a console prompt. To reboot you use shutdown -r now 1
ahuxham Posted December 2, 2009 Posted December 2, 2009 shutdown -h now works as well. H imply halt. You can also specify timings as well with -t in seconds Shutdown -r -t 120 instead of now if you so wanted. Anywho. "man shutdown" and you'll get all available commands. 1
apaton Posted December 2, 2009 Posted December 2, 2009 I always use "init 0", but maybe that a bit old school.
powdarrmonkey Posted December 2, 2009 Posted December 2, 2009 Missing the -h out of the shutdown command sometimes drops you into maintenance mode, which is scary - always include it to shut the machine down.
TechSupp Posted December 2, 2009 Author Posted December 2, 2009 Forgot all about the 'man' pages! Its been nearly 20 years since I really last worked on a Unix machine, a Sun Spark I think it was.
ZeroHour Posted December 2, 2009 Posted December 2, 2009 I will be honest I have never used -h and not had issues.
kmount Posted December 2, 2009 Posted December 2, 2009 I'm a simpleton, halt and reboot for me. Oh init 5 and init 6 if you're in Solaris land
somabc Posted December 2, 2009 Posted December 2, 2009 init 6 to reboot works on most *nix Shutdown -h -P -t now seems to work well
powdarrmonkey Posted December 2, 2009 Posted December 2, 2009 @ZeroHour: usually varies by distribution.
m0nty Posted December 2, 2009 Posted December 2, 2009 Now I'm new to nix and only use it from a boot CD for imaging PC's, but how do I exit and powerdown nix correctly, instead of just exiting the desktop and just turning off the PC Thought I'd best learn how to do it correctly! On Linux (most distros) "poweroff" and "reboot" work fine. But if you're booting from CD and haven't mounted any hard-disks, you can just switch off with impunity. -- Simon
TwoZeroAlpha Posted December 2, 2009 Posted December 2, 2009 Assuming Ubuntu (or variant) sudo shutdown -P now works pretty well for me. Capital "P" is important as it's the poweroff flag. If you've got a desktop (therefore GUI?) is there not a simple poweroff/shutdown button?
ahuxham Posted December 2, 2009 Posted December 2, 2009 I always use "init 0", but maybe that a bit old school. Indeed not, the init methods are what I still use
apaton Posted December 2, 2009 Posted December 2, 2009 One never to use on a Sun Solaris box, unless in the lab. $ uadmin 2 0 Fastest shutdown in the west!!! (Its not pretty, it just stops everything) Andy
box_l Posted December 2, 2009 Posted December 2, 2009 I always use init 0, works on any system. init 6 to reboot box
SteveBentley Posted December 3, 2009 Posted December 3, 2009 If you're working from a live CD then there's little reason not to just hit the power switch once you've unmounted any hard drives etc, you're not going to corrupt anything. However, I tend to use the halt command.
Heebeejeebee Posted December 3, 2009 Posted December 3, 2009 ** Thread hijack alert ** Sorry about the hijack but how can I shut down a nix box remotely from a Windows system with say, a batch file? Is this possible? HBJB
powdarrmonkey Posted December 3, 2009 Posted December 3, 2009 Sorry about the hijack but how can I shut down a nix box remotely from a Windows system with say, a batch file? Is this possible? With Simon Tatham's plink. 1
ahuxham Posted December 3, 2009 Posted December 3, 2009 Indeed, another way would be a batch to SSH into the machine via Putty and execute the command or .sh script as root.
apaton Posted December 3, 2009 Posted December 3, 2009 Sorry about the hijack but how can I shut down a nix box remotely from a Windows system with say, a batch file? Is this possible? HBJB This is heresy, Unix should shutdown Windows and not the other way round. net rpc shutdown -I -U % *apt-get install samba-common-bin 1
llawwehttam Posted December 4, 2009 Posted December 4, 2009 Going back to 'init 6/ 0' I'm now using Ubuntu and can't seem to 'init' or 'telinit'. Is there a way to enable it? I prefered 'init 0' to 'shutdown -h now' immensely on my fedora box.
apaton Posted December 4, 2009 Posted December 4, 2009 Going back to 'init 6/ 0' I'm now using Ubuntu and can't seem to 'init' or 'telinit'. Is there a way to enable it? I prefered 'init 0' to 'shutdown -h now' immensely on my fedora box. Check your path for /sbin or try the following command [font=Courier New]sudo /sbin/init [/font]"init" must be installed for Ubuntu to work. [font=Courier New][b]apaton@ratbox:~$ apt-file search /sbin/init[/b] mindi: /usr/lib/mindi/rootfs/sbin/init runit-run: /sbin/init [i]upstart: /sbin/init[/i] upstart: /sbin/initctl [b]apaton@ratbox:~$ dpkg --get-selections | grep upstart[/b] [i]upstart install[/i] upstart-compat-sysv deinstall upstart-logd deinstall [/font]
llawwehttam Posted December 4, 2009 Posted December 4, 2009 (edited) Init is definitely in /sbin but on typing sudo /sbin/init it asks for my password as usual but then when I type it nothing happens. I've tried this as root as well including the init and telinit commands as root and nothing happens. Everything else works under sudo so I'm not typing my password wrong or anything silly. Is this normal? Also when i type runlevel after 'init 4' it says '4 5' so it believes its in runlevel 4 even though I still have a GUI. I'm still getting used to Ubuntu and Debian after using Fedora for ages but I have heard that to change runlevel in a Debian based system you have to change the default runlevel and then reboot. Also I have heard that the runlevel numbers are different in Debian based systems. Is this true? Edited December 4, 2009 by llawwehttam
powdarrmonkey Posted December 6, 2009 Posted December 6, 2009 Init is definitely in /sbin but on typing sudo /sbin/init it asks for my password as usual but then when I type it nothing happens. I've tried this as root as well including the init and telinit commands as root and nothing happens. Everything else works under sudo so I'm not typing my password wrong or anything silly. Is this normal? Also when i type runlevel after 'init 4' it says '4 5' so it believes its in runlevel 4 even though I still have a GUI. In Debian runlevels 4 and 5 are aliases. You should be able to switch between them with telinit (not init) but I don't know the Ubuntu specifics. I'm still getting used to Ubuntu and Debian after using Fedora for ages but I have heard that to change runlevel in a Debian based system you have to change the default runlevel and then reboot. Also I have heard that the runlevel numbers are different in Debian based systems. Is this true? False.
llawwehttam Posted December 7, 2009 Posted December 7, 2009 So then if I type init 3 for instance shouldn't I't kill the GUI? Its just thats what i'm used to in Red Hat based distros but nothing seems to happen with Ubuntu even though when I use the runlevel command It claims I am in runlevel 3.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now