Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.64 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # lcd4linux
  4. #
  5. PLUGINDIR="/usr/lib/enigma2/python/Plugins/Extensions/LCD4linux"
  6. DAEMON="lcd4linux"
  7. NICELEVEL="19"
  8.  
  9. LCDMAX=`cat /etc/enigma2/settings | grep LCD4linux.LCDMax=2`
  10.  
  11. daemon_start() {
  12.     if [ -f $PLUGINDIR/dpf$1.conf ]; then
  13.         echo "Starting $DAEMON $1"
  14.         start-stop-daemon --start --nicelevel $NICELEVEL --quiet --pidfile /var/run/lcd4linux$1.pid --exec $PLUGINDIR/$DAEMON -- -q -p /var/run/lcd4linux$1.pid -f $PLUGINDIR/dpf$1.conf
  15.     else
  16.         echo $PLUGINDIR/dpf$1.conf nicht gefunden
  17.     fi
  18. }
  19. daemon_stop() {
  20.     if [ -f /var/run/lcd4linux$1.pid ]; then
  21.         echo "Stopping $DAEMON $1"
  22.         start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/lcd4linux$1.pid --exec $PLUGINDIR/$DAEMON
  23.         sleep 2
  24.         echo "LCD::backlight(0)" | $PLUGINDIR/$DAEMON -i -f $PLUGINDIR/dpf$1.conf
  25.     fi
  26. }
  27. daemon_reload() {
  28.     if [ -f /var/run/lcd4linux$1.pid ]; then
  29.         start-stop-daemon --stop --signal 1 --quiet --pidfile /var/run/lcd4linux$1.pid --exec $PLUGINDIR/$DAEMON
  30.     fi
  31. }
  32.  
  33.  
  34. case "$1" in
  35.     start)
  36.         daemon_start 1
  37.         if [ $LCDMAX ]; then
  38.             daemon_start 2
  39.         fi
  40.     ;;
  41.     start1)
  42.         daemon_start 1
  43.     ;;
  44.     start2)
  45.         daemon_start 2
  46.     ;;
  47.     stop)
  48.         daemon_stop 1
  49.         if [ $LCDMAX ]; then
  50.             daemon_stop 2
  51.         fi
  52.     ;;
  53.     stop1)
  54.         daemon_stop 1
  55.     ;;
  56.     stop2)
  57.         daemon_stop 2
  58.     ;;
  59.     reload)
  60.         daemon_reload 1
  61.         if [ $LCDMAX ]; then
  62.             daemon_reload 2
  63.         fi
  64.     ;;
  65.     restart|force-reload)
  66.         daemon_stop 1
  67.         if [ $LCDMAX ]; then
  68.             daemon_stop 2
  69.         fi
  70.         sleep 4
  71.         daemon_start 1
  72.         if [ $LCDMAX ]; then
  73.             daemon_start 2
  74.         fi
  75.     ;;
  76.     *)
  77.         echo "Usage: $0 {start|stop|restart|reload|force-reload|start1|start2|stop1|stop2}" >&2
  78.         exit 1
  79.     ;;
  80. esac
  81. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement