highking Posted October 29, 2003 Report Share Posted October 29, 2003 Hi, On my laptop, KLaptop is able to execute a command when the battery is low. Now I would like to insert this command: shutdown -h 1 So I would have 1 minute to save my work, before the laptop starts shutting itself down. Well, I thought this would work, but since normal users aren't able to shut down the system, it doesn't! Is there a way to enable shutdown for all users? So this thing works? Quote Link to comment Share on other sites More sharing options...
phunni Posted October 29, 2003 Report Share Posted October 29, 2003 You can use sudo to enable a normal user to run shutdown. This is probably a safer approach than simply allowing a normal user to run shutdown directly Quote Link to comment Share on other sites More sharing options...
highking Posted October 29, 2003 Author Report Share Posted October 29, 2003 Ok. but could you also tell me how to use this? When I type: sudo shutdown -h 1 It asks for a password, wich means I cannot use it to automate the shutdown. Quote Link to comment Share on other sites More sharing options...
phunni Posted October 29, 2003 Report Share Posted October 29, 2003 You can configure sudo to allow you to run a command without asking for a password - I've only recently rebuilt my machine and not got round to doing this myself yet so I'm afraid I don't have an example. I believe that the config files installed with sudo may have some examples in them though... Quote Link to comment Share on other sites More sharing options...
ramfree17 Posted October 30, 2003 Report Share Posted October 30, 2003 this mandrakesecure.net article should get you up to speed on configuring sudo. :) ciao! Quote Link to comment Share on other sites More sharing options...
highking Posted October 30, 2003 Author Report Share Posted October 30, 2003 Cool! I'm @ work right now, but I will read this article this evening. Update: It works! I'm now able this command, without being root! :) Now, i'll just have to wait and see if the system can use it also. :huh: Quote Link to comment Share on other sites More sharing options...
highking Posted November 2, 2003 Author Report Share Posted November 2, 2003 Well, it doesn't really work after all. It seems like the command should be run from a console, but since the command is run directly by KLaptop, it simply doesn't run. Maybe someone could tell me how I can make KLaptop start a shell before it runs the command? :unsure: Quote Link to comment Share on other sites More sharing options...
phunni Posted November 2, 2003 Report Share Posted November 2, 2003 Can't help you there I'm afraid as I don't use KLaptop - I'm not sure I understand what you mean by "run in a console"... One thing you could try (and this is how my system is set up) is write a shell script to perform the shutdown (and anything else you need to do to make it a neat, clean shutdown) and get KLaptop to run that instead of the sudo command directly. As I say, this is how my system is set up, and I run the scripts from a Dock app - not directly from a console Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.