Turning off computer with a single command
One thing that has really started to annoy me every night is when I am falling half asleep in front of the pc and I click on shutdown and then have to wait for everything to close and for the computer to tell me that it is safe to turn it off. Is it possible to shutdown linux with a single command just as in windows? or be able to shut it down by hitting the reset button?
running mandrake 10.1 |
As root, or with sudo, issue the command
Code:
/sbin/shutdown -h -t0 now Peace, JimBass |
I've got Ctrl-Alt-Del mapped to 'shutdown -h now', but that doesn't work in X, so it might not be a lot of use.
Dave |
in ~/.bashrc add this line with your current aliases
alias off="sudo /sbin/poweroff" assuming sudo is setup for it, you can then issue the command "off" from a terminal to shut down. |
I found this on the net, but shamefully cannot remember where...
So, I'm not claiming originallity for it, and appologise to the original author!: ---------------------------------------- Making poweroff and reboot buttons In Slackware when we want to power-off we need to give the command shutdown -h now as root in a terminal. (Because there is no entry for shutdown in the menu) We can make a power-off button, but it needs some work, here is how to do that: Edit the sudoers file, as root, with vi. There is a special command to open the sudoers file in vi though - NOT vi sudoes, but: Code:
# visudo Code:
username ALL=(ALL) NOPASSWD: /sbin/shutdown -h now, /sbin/reboot Then save and close the file: We now gave bruno sudo permission to give the commands sudo /sbin/reboot and sudo /sbin/halt and we can meke special buttons on the tastbar: Rightclick on the taskbar and choose Add | Special Button | Non-KDE application. You will get a little GUI where you can put in the top box (Executable): Code:
sudo /sbin/reboot Do the same for: Code:
sudo /sbin/halt ------------------------------------------------ After that, I made a toolbar short cut to /sbin/shutdown -h now which works. So, when logged in as a regular user, I can shut the PC off properly without having to log out, login as root & then shutdown. |
Why shut it down? I have cron jobs that run and do stuff for me during my physical sleep. I like my computer to do work while I take it easy, so the only time I go down is when I decide to switch between my 4 operating systems.
alias is your friend, see my .bashrc file. Code:
# Duron 950 uilleann .bashrc for root Code:
# Duron 850 tinwhistle .bashrc for user fancy |
When I type
/sbin/shutdown -h -t0 now the computer closes all programs running and then tells me its ok to shut it down, so it is the same as shutting it down through the gui. What I want to be able to do is to click on shutdown in the GUI and have the pc shutdown automatically, not have to wait for all the programs to close and then press the reset button. This may not be a critical problem but it is really annoying having to wait for all the programs to close in order for the pc to shutdown |
If you want your data written to disk correctly before shutting down, the programs need to close to sent the stuff to the disk properly. You risk data corruption if the processes aren't stopped.
I can open an x terminal, give these commands and everything turns off for me: god <give password> off sudo might be better, but I am stuck in my rut from my 1999 Linux install. |
If your computer doesn't physically power off, it is missing kernel modules, or has a promblem with acpi or apm, whichever power management you're using. Do a search here on linux questions or google.com/linux, and you'll find ways to modify things so the power will shut off at the end of a shutdown.
Peace, JimBass |
From my experience, it seems generally laptops use apm and desktops use acpi. You just need to load the modules so the kernel can access the physical hardware required to poweroff.
|
I think cs-cam, got the right answer. You didn't explain the real problem at the beginning too
|
# init 0
|
All times are GMT -5. The time now is 07:14 AM. |