To accommodate both requirements, you can create an executable shell script that can be executed via the command line or a double-click as well as something that is run at startup.
1 — Create a Shell Script
First, put the commands into a shell script. For example, in /home/{user}/iGotThePower.sh
(do change the name if you'd like something more appropriate):
#!/bin/bash
echo 0 | sudo tee /sys/module/snd_hda_intel/parameters/power_save_controller
echo 0 | sudo tee /sys/module/snd_hda_intel/parameters/power_save
Be sure to replace {user}
with your home directory name.
2 — Create a systemd
service
Next, you'll need to create a file at /etc/systemd/system/iGotsPower.service
(again, you can change this name):
[Unit]
After=network.service
[Service]
ExecStart=/home/{user}/iGotThePower.sh
[Install]
WantedBy=default.target
3 — Set Permissions
We'll need to make sure the permissions are correct:
$ sudo chmod 664 /etc/systemd/system/iGotsPower.service
$ sudo chmod 744 /home/{user}/iGotThePower.sh
$ sudo chmod +x /home/{user}/iGotThePower.sh
4 — Enable the Service Unit
Now that the basics are in place, we can enable the new service:
$ sudo systemctl daemon-reload
$ sudo systemctl enable iGotsPower.service
5 — Test with a Reboot
Now that all the core elements are in place, you can test this by rebooting. Double-clicking on the iGotThePower.sh
file should also execute the script whenever you would like to have it run. Alternatively, you can open a terminal and type ./iGotThePower.sh
to execute the two lines within.
Hope this gives you what you're looking for.