Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What does my computer do when I click Power Cog Icon (System Devices Menu)Shut Down? I mean, is it running a script? What is it running?

share|improve this question
2  
    
thanks @Achu. helpful article –  geoh May 13 '12 at 19:55
add comment

1 Answer 1

up vote 3 down vote accepted

Your system then calls the command shutdown. Logins are prevented and all users are notified of the impending shutdown. The command has a parameter called TIME, which is how long until the shutdown occurs. When you use the shut down from the corner the argument is now. According to the manual page of shutdown, after time has elapsed the shutdown command sends a request to the init daemon which is what really shuts the system down for good.

To execute this same process yourself you can run the command:

sudo shutdown now
share|improve this answer
    
but when i run shutdown from terminal it wants root privileges –  geoh May 13 '12 at 19:43
    
but when i click shutdown it didn't wan't password –  geoh May 13 '12 at 19:49
    
yes but i want to know how to shutdown system from terminal without root privileges @Dymatic –  geoh May 13 '12 at 19:50
    
You raise a good point. My guess is it tells the init daemon to quit directly. This way it does what shutdown does without actually having to run it. How you would go about telling init to do this is beyond my ability, however. –  Dymatic May 13 '12 at 19:52
5  
if you want the system to poweroff that should ideally be sudo shutdown -P now ;) As for explaining why the desktop ask for credentials, it's because the X window system and the desktop are run with root privileges :) –  jackweirdy May 13 '12 at 19:52
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.