Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HDD temp won't show via web

I'm trying to display my PIs temperatures in a website that I can access anywhere at any time.

So far I've been able to get the CPU and GPU temps working. However my HDD temp won't show in the browser. It works fine in terminal.

Here is a pic:

Image

As you'll notice I didn't have the GPU temp showing either, however this was fixed by using the following command:

sudo usermod -G video www-data

I haven't been successful in getting this to work for smartmoxntools, though.

Does anyone know how to make it work?

Also, is it safe to have these in an external website? Can hackers inject php code to run shell commands using it?

like image 267
Rapid Avatar asked Jan 25 '16 12:01

Rapid


People also ask

Why can't I see the temperature of my hard drive?

Another possibility is that your hard drive is not supported, or you're using a Virtual Machine. Manage Disks and Volumes does support all hard drives, including SSD drives. Click on the hard drive you want to see the temperature of, and click on Properties.

How do I check the temperature of my SSD drive?

Manage Disks and Volumes does support all hard drives, including SSD drives. Click on the hard drive you want to see the temperature of, and click on Properties. You can find your current temperature under Drive health .

Why won’t my files show up on my hard drive?

Sometimes, when your internal or external hard drive connection is loosened, the device will not be able to show up the saved files on your computer. So the best way out is to reconnect the drive and make files show up again. Step 1. Reconnect the internal or external hard drive on your computer. To Reconnect Hard Drive:

How to fix HDD not showing up in disk management error?

Fix HDD Not Showing Up in Disk Management Error. If the HDD fails to show up in the Disk Management on your computer, follow the below tips: 1. Press Win + R keys to bring up Run dialog and type: diskmgmt.msc, hit Enter. 2. Find your HDD hard drive and right-click on it, select Change Drive Letter and Paths.


2 Answers

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
like image 140
Allen Avatar answered Oct 11 '22 18:10

Allen


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}'
like image 43
Mark Setchell Avatar answered Oct 11 '22 16:10

Mark Setchell