Git Product home page Git Product logo

hddtempsafe's Introduction

HddTempSafe

Tool to read hard disk temperature from hddtemp's TCP interface.

VN

hddtemp is a popular CLI tool to retrieve HDD temperature. Due to its small footprint and command-line interface, it is often called by other scripts, like conky. However, running the hddtemp directly as a command needs root permission. To be able to use it smoothly from an unpriviledged script, ones often apply a trick: Set SUID bit for the /usr/sbin/hddtemp binary. I feel to grant root permission is too much and want to avoid it. Fortunately, hddtemp can run as daemon and provides a TCP interface for normal users to get its data without having to escalating priviledge.

This tool is to help other scripts get HDD temperature from hddtemp via that TCP interface. It is written in Lua (5.3) to remain lightweight.

Install

Ubuntu

This software is packaged as *.deb file for Ubuntu and derivatives (Linux Mint etc.). Please install it from PPA:

sudo add-apt-repository ppa:ng-hong-quan/ppa
sudo apt-get update
sudo apt install hddtemp-safe

Other distros

For other distros, HddTempSafe can be installed from source.

git clone https://github.com/hongquan/HddTempSafe.git

cd HddTempSafe

sudo make install

You can also install it to local user folder with (without sudo):

make install

HddTempSafe will be installed to ~/.local/bin folder. Please make sure that this folder is in your PATH environment variable. Normally, you don't have to worry if your default shell is Bash and you are using Debian derivative OSes (like Ubuntu, Linux Mint etc.). But if your default shell is Zsh, please check (default config template for Zsh on Ubuntu does not include this folder in PATH).

When installing HddTempSafe from source, other software dependencies will not be installed automatically. Please install them yourselves. They are:

  • hddtemp (of course)
  • lua5.3
  • lua-luxio
  • lua-argparse
  • lua-socket

Assume that you already installed hddtemp. By default, on Debian & Ubuntu, it is not running in daemon mode. You need to configure it to run as daemon by editing /etc/default/hddtemp file, making sure that the file has this line:

RUN_DAEMON="true"

After changing the configuration, you need to start it up:

sudo systemctl enable --now hddtemp.service

Usage

You can run the tool with --help switch to see available options:

$ hddtemp-safe --help

Usage: hddtemp-safe [-p <port>] [-h] <disk>

Get HDD temperature from hddtemp daemon

Arguments:
   disk                  Disk path, e.g. /dev/sda

Options:
       -p <port>,        hddtemp's listening port (default 7634)
   --port <port>
   -h, --help            Show this help message and exit.

To read temperature of /dev/sda:

$ hddtemp-safe /dev/sda
39

Credit

Brought to you by Nguyễn Hồng Quân.

hddtempsafe's People

Contributors

hongquan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.