Jump to content

Shutdown automatically when battery is low


highking
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...