Add Upstart (ubuntu) job

This commit is contained in:
Trevor Joynson (trevorj) 2012-08-19 08:33:35 -04:00
parent ef8cda3b2d
commit 398e65ad5f
2 changed files with 41 additions and 2 deletions

View file

@ -56,11 +56,24 @@ clean:
install: install:
cp $(EXE) /usr/sbin cp $(EXE) /usr/sbin
@echo "-----------------------------------------------------------------------------" @echo "-----------------------------------------------------------------------------"
@echo "An init file suitable for /lib/lsb/init-functions (Debian & Ubuntu fur sure)" @echo "An init file suitable for /lib/lsb/init-functions (Debian) is located in"
@echo "Is located in the main folder of the source files. It is called mbpfan.init." @echo "in the main folder of the source files. It is called mbpfan.init."
@echo "Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)" @echo "Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)"
@echo "and move it to /etc/init.d" @echo "and move it to /etc/init.d"
@echo "Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults" @echo "Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults"
@echo ""
@echo "Additionally, an init file suitable for /etc/rc.d/init.d/functions"
@echo "(RHEL/CentOS & Fedora) is also located at the same place, this file is called"
@echo "mbpfan.init.redhat. Also rename it to mbpfan, give it execution permissions"
@echo "and move it to /etc/init.d"
@echo "To add the script to the default runlevels, run the following as root:"
@echo "chkconfig --level 2345 mbpfan on && chkconfig --level 016 mbpfan off"
@echo ""
@echo "For upstart based init systems (Ubuntu), an example upstart job has been"
@echo "provided for use in place of the LSB-style init script. To use, execute"
@echo "as root:"
@echo "cp mbpfan.upstart /etc/init/mbpfan.conf"
@echo "start mbpfan"
@echo "-----------------------------------------------------------------------------" @echo "-----------------------------------------------------------------------------"
rebuild: clean all rebuild: clean all

26
mbpfan.upstart Normal file
View file

@ -0,0 +1,26 @@
# mbpfan - A simple daemon to control fan speed on all Macbook/Macbook Pros \
# (probably all Apple computers) for Linux 3.x.x
description "mbpfan"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
umask 022
console log
pre-start script
test -x /usr/sbin/mbpfan || { stop; exit 0; }
# A way to turn pidfile writing off would be nice. That or mbpfan
# could check for staleness before refusing to control your fans.
rm -f /var/run/mbpfan.pid
end script
# Starting mbpfan in the foreground without being in an interactive tty currently
# seems to segfault, so expect forkage.
expect fork
exec /usr/sbin/mbpfan