HDD temp won't show via web HDD temp won't show via web linux linux

HDD temp won't show via web


in order to run some root privileged command in website, you need to put www-data in your /etc/sudoers to allow the www-data to run as root for the command, here is the line you need in /etc/sudoers:

www-data ALL=(root) NOPASSWD: /usr/sbin/smartctl


When executing under your web server, your script will probably have a different PATH configured, so it will run differently from how it runs in the Terminal.

Try putting the full path to smartctl in your script, e.g.

sudo /usr/local/bin/smartctl -A -d sat /dev/sda | awk '/^194/ {print $10}'