Skip to content

Instantly share code, notes, and snippets.

@vrdominguez
Created February 12, 2014 16:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrdominguez/8958308 to your computer and use it in GitHub Desktop.
Save vrdominguez/8958308 to your computer and use it in GitHub Desktop.
lcd-daemon init.d
#! /bin/bash
# Copyright (c) 1996-2012 My Company.
# All rights reserved.
#
# Author: Victor Rodriguez, 2014
#
# /etc/init.d/lcd-daemon
#
### BEGIN INIT INFO
# Provides: lcd-daemon
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: LCD daemon process
# Description: Runs LCD daemon process for
# Texy's Nokia LCD screen
### END INIT INFO
# What is this?
DESC="LCD info daemon"
case "$1" in
start)
echo "Starting lcd screen daemon"
# Start the daemon
/usr/bin/python /home/lcd-daemon/lcdDaemon.py start
;;
stop)
echo "Stopping lcd screen daemon"
# Stop the daemon
/usr/bin/python /home/lcd-daemon/lcdDaemon.py stop
;;
restart)
echo "Restarting lcd screen daemon"
/usr/bin/python /home/lcd-daemon/lcdDaemon.py restart
;;
status)
if [ -f /var/run/lcdDaemon.pid ]; then
kill -0 `cat /var/run/lcdDaemon.pid`
if [ "$?" == "0" ]; then
echo "lcdDaemon running"
exit 0
else
echo "lcdDaemon stopped"
exit 1
fi
else
echo "lcdDaemon stopped"
exit 1
fi
;;
*)
# Refuse to do other stuff
echo "Usage: service lcd-daemon {start|stop|restart|status}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment