2

I made a service following this guide so I did: Created a systemd service unit Created a startup shell script Configured and installed the service

Now, my script is this one. Basically, at startup it did something depending if my laptop is charging or not, and then every X minutes it check it again and set CPUs frequencies etc..

Now, sometimes it happens I want to stop it to reobtain full power by my laptop, so I stop it, but I now should set again CPUs frequencies etc. Is it possible that, when I do systemctl stop battery-script.service it execute another script or some lines of code before stopping? Thanks in advance

1

According to documentation I have to use ExecStop= in my battery-script.service. Now it looks like:

[Unit]


[Service]
ExecStart=/usr/local/bin/battery.sh
ExecStop=/usr/local/bin/battery-stop.sh

[Install]
WantedBy=default.target

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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