I can’t find very good documentation on how to do this effectively. I’d like to create two separate scripts that will change the radeon-dpm profile with the commands
echo low | sudo tee /sys/class/drm/card0/device/power_dpm_force_performance_level
echo auto | sudo tee /sys/class/drm/card0/device/power_dpm_force_performance_level
I want these scripts to run when I change the platform profile, the only problem is that the command needs sudo to run. I can’t use TLP because it conflicts with power-profiles-daemon. How would I give the scripts I’d put these commands into the ability to run without typing in my password
I’m not trying to do it on AC detection but rather whenever I flip the perfromance slider. In KDE there’s an option to run a script when you change the platform profile but I can’t run those commands in the script because they require sudo
Everything is explained in man sudoers
.
Example:
edaw ALL = NOPASSWD: /usr/bin/your_script.sh
Now user edaw
will not be asked for a password when running this script with sudo.
Shouldn’t the script go into
/usr/local/bin/
?
Only if the script should be safe from being overwritten on updates, but normally you would choose a name which is rather unique. /bin, /sbin, /usr/sbin is a symlink to /usr/bin therefore this is used for system and user binaries.
But yeah if you follow the FHS then any locally installed applications (by make or custom setups) should be installed in /usr/local, but who does it that accurate?