Announcement

Collapse
No announcement yet.

bash script requiring root permisions

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    bash script requiring root permisions

    Hi there.

    I have a shell script ( https://github.com/bokiscout/dot-fil...an_controll.sh ) that is monitoring the temperature and fan speed of my GPU (Assus Strix RX 570).

    To modify the fan speed I must edit some "files" (interfacing with the driver) that require root permissions.

    I see two solutions but I displake them both. I want to hear if there is any better solution than this.

    1. Change the permissions of the files.
    Security night mare. I don't want to do this. Beside that after restart permissions are reverted back.

    2. Execute the shell script as root
    - I need to type the password every time I run this script. That is every time I turn on the PC. It's boring.
    - Or pipe the password to the shell script. I don't want to write root password in plain text.

    What is your suggestion to automate this?
    Execution as systemd service maybe... Tell me some nice idea if You have one.

    #2
    More info about when or why you run the script would be helpful. If it's just at start up why not just call it from rc.local?

    This might help: https://askubuntu.com/questions/9190...-using-systemd

    There's an "rc.local" service to maintain compatibility with rc.local functionality. I think all you have to do is create /etc/rc.local and call your script from there - assuming that's what you want.

    Please Read Me

    Comment


      #3
      Sorry for late reply.

      Actually the open source driver (never tried proprietary one) do not have proper GPU fan configuration for Assus Strix RX 570 GPU model.
      - The GPU should run passive (fan at 0 rpm) until 50 *c (it does on Windows).
      - Unfortunately the fan never goes below 50% even if the GPU is at 35*.

      The fan start spinning at 50% pwm just after GRUB screen (when the drivers are loaded) and never goes down. It goes up when gaming but then back to 50% pwm and never 0rpm.

      Anyway, by simply writing proper values to:
      /sys/class/drm/card0/device/hwmon/hwmon0/pwm1_enable
      /sys/class/drm/card0/device/hwmon/hwmon0/pwm1

      user can set the fan manually to 0rpm until the temp reaches 50*c, then incrementing the speed until 60*c, and if over 60 put the fan speed to auto mode (let the driver decide by it self). This is what my bash script is doing.

      As for the suggestion for systemd service, I followed the information at the link provided, and the script is automatically executed and the fan is at 0rpm when idling.

      Thank You.

      Comment

      Working...
      X