You are not logged in.

#1 2013-09-03 13:48:50

aaditya
Member
Registered: 2013-09-01
Posts: 174

[SOLVED]Create .service file to load powertop settings at startup.

Hi I installed powertop and ran it

sudo powertop -html

and the recommendations I got, i pasted them in a file, and saved it as startup.sh, and made it executable.
Now with init, i could write it in /etc/rc.local so that it would be called automatically at startup, but with systemd,
I think one would need to create a systemd service file which could be enabled for startup,and would call the startup.sh file.
Can anyone help with creating the .service file, or alternatively, suggest a simpler method for loading powertop's reccomendations at startup? Thanks!

Last edited by aaditya (2013-09-04 18:29:53)

Offline

#2 2013-09-03 17:02:03

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED]Create .service file to load powertop settings at startup.

Really, this should be done with the tools that are inherently in the system.  So it should be achieved with module options, udev rules, sysctl.d/sysctl.conf, and in some cases, tmpfiles.d.

See this wiki page to get an idea of how to get this stuff going.

You can use some kind of rc.local service if you want.  But it is probably moer appropriate to have these things load only if necessary.  For example, if there is a power saving option for my ethernet card, but I choose to only load the module when I need it (therefore blacklist it) in order to really save power, it would be silly to have a script that tries to write values to a directory in /sys/class/net that doesn't exist.

Alternatively, you could use something like laptop-mode-tools, which allows one to have these settings turned on or off depending on the A/C state of the machine. But I really think that with machines these days, there is really not much of a difference whether these power saving functions are on or off, in terms of an average users computing experience.

Offline

#3 2013-09-04 02:51:49

Pse
Member
Registered: 2008-03-15
Posts: 413

Re: [SOLVED]Create .service file to load powertop settings at startup.

If you insist in using a systemd service for this, you can take a look at rsyncd's service file, it's fairly simple:

[Unit]
Description=A file transfer program to keep remote files in sync

[Service]
ExecStart=/usr/bin/rsync --daemon --no-detach
RestartSec=1

[Install]
WantedBy=multi-user.target

Note that if there are other tools handling power management in your system, these settings may get overwritten after they are applied.

Edit: for a simple run-once script, you should remove RestartSec and add Type=oneshot in the [Service] section above.

Last edited by Pse (2013-09-04 02:55:25)

Offline

#4 2013-09-04 03:01:00

SilverOne
Member
From: Portugal
Registered: 2013-08-22
Posts: 69

Re: [SOLVED]Create .service file to load powertop settings at startup.

Hello!

laptop-mode-tools seems to take care of all the recommendations except VM writeback timeout.

I would give it a try.


Best Regards,
SilverOne

Offline

#5 2013-09-04 18:28:09

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: [SOLVED]Create .service file to load powertop settings at startup.

Thank You all for your suggestions! smile Will try to implement them. Marking it as solved.

Offline

Board footer

Powered by FluxBB