Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ### BEGIN INIT INFO
- # Provides: oscam
- # Required-Start: $local_fs $network
- # Required-Stop: $local_fs $network
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: Init script for oscam
- ### END INIT INFO
- . /lib/lsb/init-functions
- NAME=oscafixe.x64
- DAEMON="/srv/oscafixe"
- PIDFILE=/tmp/.oscam/oscam.pid
- DAEMON_OPTS="-c /srv/oscafixe"
- start() {
- echo -n "Starting daemon: "$NAME
- start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
- echo "."
- }
- stop() {
- echo -n "Stopping daemon: "$NAME
- start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
- echo "."
- }
- restart(){
- stop
- sleep 3
- start
- }
- status(){
- pidof $DAEMON > /dev/null 2>&1
- RETVAL=$?
- if [ $RETVAL -ne 0 ]; then
- echo "$NAME is not running"
- exit $RETVAL
- else
- echo "$NAME is running"
- fi
- }
- reload(){
- kill -1 $(cat $PIDFILE)
- RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- echo "$NAME reloading successfully"
- else
- echo "$NAME reloading failed"
- exit $RETVAL
- fi
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- status)
- status
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|reload|status}"
- exit 1
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement