Commit 8ed60e90 authored by Daniel Graziotin's avatar Daniel Graziotin

Fixes #14 and enhances Readme.md

parent fcf18f52
...@@ -58,6 +58,10 @@ tests: ...@@ -58,6 +58,10 @@ tests:
make install make install
sudo /usr/sbin/mbpfan -f -v -t sudo /usr/sbin/mbpfan -f -v -t
uninstall:
rm /usr/sbin/mbpfan
rm /etc/mbpfan.conf
install: install:
make make
cp $(EXE) /usr/sbin cp $(EXE) /usr/sbin
......
...@@ -56,32 +56,38 @@ sudo service mbpfan start ...@@ -56,32 +56,38 @@ sudo service mbpfan start
Starting at boot Starting at boot
---------------- ----------------
An init file suitable for /lib/lsb/init-functions (Debian & Ubuntu for sure) **Ubuntu**
For upstart based init systems (Ubuntu), an example upstart job has been
provided for use in place of the LSB-style init script.
To use, execute:
sudo cp mbpfan.upstart /etc/init/mbpfan.conf
sudo start mbpfan
**Debian**
An init file suitable for /lib/lsb/init-functions (Debian)
is located in the main folder of the source files, called mbpfan.init.debian is located in the main folder of the source files, called mbpfan.init.debian
Rename it to mbpfan, give it execution permissions (chmod +x mbpfan) Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)
and move it to /etc/init.d and move it to /etc/init.d
Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults
Additionally, an init file suitable for /etc/rc.d/init.d/functions **Redhat, CentOS, Fedora**
An init file suitable for /etc/rc.d/init.d/functions
(RHEL/CentOS & Fedora) is also located at the same place, this file is called (RHEL/CentOS & Fedora) is also located at the same place, this file is called
mbpfan.init.redhat. Also rename it to mbpfan, give it execution permissions mbpfan.init.redhat. Also rename it to mbpfan, give it execution permissions
and move it to /etc/init.d and move it to /etc/init.d
To add the script to the default runlevels, run the following as root: To add the script to the default runlevels, run the following as root:
chkconfig --level 2345 mbpfan on && chkconfig --level 016 mbpfan off chkconfig --level 2345 mbpfan on && chkconfig --level 016 mbpfan off
For upstart based init systems (Ubuntu), an example upstart job has been **systemd**
provided for use in place of the LSB-style init script. To use, execute
as root:
cp mbpfan.upstart /etc/init/mbpfan.conf
start mbpfan
As a special bonus, a service file for systemd is also included. To use it, As a special bonus, a service file for systemd is also included. To use it,
execute the following as root: execute the following as root:
cp mbpfan.service /usr/lib/systemd/system sudo cp mbpfan.service /usr/lib/systemd/system
ln -s /usr/lib/systemd/system/mbpfan.service /etc/systemd/system/mbpfan.service sudo ln -s /usr/lib/systemd/system/mbpfan.service /etc/systemd/system/mbpfan.service
systemctl daemon-reload sudo systemctl daemon-reload
systemctl start mbpfan.service sudo systemctl start mbpfan.service
To start the service automatically at boot, also execute the following: To start the service automatically at boot, also execute the following:
systemctl enable mbpfan.service sudo systemctl enable mbpfan.service
Usage Usage
......
...@@ -78,7 +78,7 @@ t_sensors *retrieve_sensors() ...@@ -78,7 +78,7 @@ t_sensors *retrieve_sensors()
const char *path_end = "_input"; const char *path_end = "_input";
int path_size = strlen(path_begin) + strlen(path_end) + 2; int path_size = strlen(path_begin) + strlen(path_end) + 2;
char number[1]; char number[2];
sprintf(number,"%d",0); sprintf(number,"%d",0);
int i = 0; int i = 0;
...@@ -132,7 +132,7 @@ void find_fans(t_sensors* sensors) ...@@ -132,7 +132,7 @@ void find_fans(t_sensors* sensors)
int path_min_size = strlen(path_begin) + strlen(path_output_end) + 2; int path_min_size = strlen(path_begin) + strlen(path_output_end) + 2;
int path_man_size = strlen(path_begin) + strlen(path_man_end) + 2; int path_man_size = strlen(path_begin) + strlen(path_man_end) + 2;
char number[1]; char number[2];
sprintf(number,"%d",0); sprintf(number,"%d",0);
int n_sensors = 0; int n_sensors = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment