LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Shutting down as a normal user (https://www.linuxquestions.org/questions/slackware-14/shutting-down-as-a-normal-user-808727/)

Josh000 05-19-2010 11:52 PM

How is a script a better solution than an alias? I would think an alias is a simpler solution...

samac 05-20-2010 03:58 AM

Quote:

Unfortunately, pressing the power button is not at all a solution.
[PEDANT ALERT]

The object of the exercise is to allow non root users to shut down your computer. Pressing the power button shuts the machine down cleanly for any user. This is the desired effect therefore it is a solution. It may not be the solution that you like, but it is a solution.

[/PEDANT ALERT]

samac

catkin 05-20-2010 04:18 AM

Quote:

Originally Posted by Josh000 (Post 3974961)
How is a script a better solution than an alias? I would think an alias is a simpler solution...

It avoids having a "long alias" to quote your post!

Josh000 05-20-2010 04:32 AM

Quote:

Originally Posted by catkin (Post 3975201)
It avoids having a "long alias" to quote your post!

So why is a long alias a bad thing?

I think having a line in ~/.zprofile or whatever is simpler than having a different script file

Richard Cranium 05-20-2010 09:12 AM

You were the one complaining about the long alias! Sheesh.

catkin 05-20-2010 09:30 AM

Quote:

Originally Posted by Richard Cranium (Post 3975497)
You were the one complaining about the long alias! Sheesh.

Some of my best friends are long aliases :D

TSquaredF 05-20-2010 10:11 AM

My solution to this was to add my user to the wheel group, modify the sudoers file as noted above & add these commands to .bashrc & .bash_profile:
Code:

alias reboot='sudo /sbin/reboot'
alias halt='sudo /sbin/halt'

Problem solved. No "long alias", no script, no password, no different commands to remember.
Regards,
Bill

Lufbery 05-20-2010 12:13 PM

Quote:

Originally Posted by samac (Post 3975183)
The object of the exercise is to allow non root users to shut down your computer. Pressing the power button shuts the machine down cleanly for any user.

I'm not the OP, but I've had a different experience. A few months ago, my wife shutdown the computer with the power button and the result was corrupted KDE settings.

I wasn't there, so I'm not sure how she did it or what exactly she did, but having an actual command to type will work best for us.

Regards,

Richard Cranium 05-20-2010 12:54 PM

Quote:

Originally Posted by samac (Post 3975183)
[PEDANT ALERT]

The object of the exercise is to allow non root users to shut down your computer. Pressing the power button shuts the machine down cleanly for any user. This is the desired effect therefore it is a solution. It may not be the solution that you like, but it is a solution.

[/PEDANT ALERT]

samac

You are assuming that the user has physical access to the machine in question. The command allows you to turn off the machine when you are nowhere near it.

samac 05-20-2010 01:58 PM

Quote:

You are assuming that the user has physical access to the machine in question. The command allows you to turn off the machine when you are nowhere near it.
I have assumed nothing. The OP never stated that he was dealing with a remote machine so my answer was tailored to that fact.

Quote:

I'm not the OP, but I've had a different experience. A few months ago, my wife shutdown the computer with the power button and the result was corrupted KDE settings.

I wasn't there, so I'm not sure how she did it or what exactly she did, but having an actual command to type will work best for us.
Agreed a command is best, however if you have a frozen keyboard and mouse it is a wonderful standby.

samac

Josh000 05-20-2010 10:15 PM

Quote:

Originally Posted by samac (Post 3975183)
[PEDANT ALERT]

The object of the exercise is to allow non root users to shut down your computer. Pressing the power button shuts the machine down cleanly for any user. This is the desired effect therefore it is a solution. It may not be the solution that you like, but it is a solution.

[/PEDANT ALERT]

samac

That's just bad pedantry.

I specifically said I wanted to it from the command line, and that I did not want to press the powerbutton. So, no, it isn't a solution to the problem I posed.

Quote:

Originally Posted by Richard Cranium (Post 3975497)
You were the one complaining about the long alias! Sheesh.

What? I'm sure I wasn't....confused now.

Anyway, I got an answer, so thanks guys.

Lufbery 05-21-2010 09:25 PM

This is a great thread! Thanks, Josh, for starting it.

What I did was take the DBUS command from Fidori and put it in a script called, poweroff.sh.

Then I put an alias to that script in each of mine and my wife's .bashrc files.

Regards,

BrZ 05-22-2010 08:41 AM

Quote:

Originally Posted by Lufbery (Post 3977186)
What I did was take the DBUS command from Fidori and put it in a script...

Same here, except alias. Thanks Fidori.


All times are GMT -5. The time now is 07:32 AM.