All pastes #191705 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-10-05 07:50 UTC
rendered paste body
#!/bin/sh
# Script made by radi0head on irc.freenode.net ##slackware
# Start/stop/restart mythbackend as user.
# Don't forget to add your username to the audio/video groups ie.: /etc/group
# Modify the USER= string to point to your username.

USER=freakshow

mythbackend_start() {
  /bin/su $USER -c \
  "/usr/bin/mythbackend -d 1> /dev/null 2> /dev/null"
  echo "Starting mythbackend..."
}

mythbackend_stop() {
  /bin/su $USER -c \
  "/bin/killall mythbackend"
  echo "Stopping mythbackend..."
}

mythbackend_restart() {
  /bin/su $USER -c \
  "/bin/killall mythbackend
  /usr/bin/sleep 1
  /usr/bin/mythbackend -d 1> /dev/null 2> /dev/null"
  echo "Restarting mythbackend..."
}

case "$1" in
'start')
  mythbackend_start
  ;;
'stop')
  mythbackend_stop
  ;;
'restart')
  mythbackend_restart
  ;;
*)
  # Default is "start"
  mythbackend_start
esac