Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- ### BEGIN INIT INFO
- # Provides: Auto-sub application instance
- # Required-Start: $all
- # Required-Stop: $all
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: starts instance of Auto-sub
- # Description: starts instance of Auto-sub using start-stop-daemon
- ### END INIT INFO
- ############### EDIT ME ##################
- QPKG_NAME=AutoSub
- QPKG_DIR=$(/sbin/getcfg $QPKG_NAME Install_Path -f /etc/config/qpkg.conf)
- DAEMON=/opt/bin/python2.7
- DAEMON_OPTS="/share/CACHEDEV1_DATA/.qpkg/autosub/autosub-bootstrapbill/AutoSub.py -c /share/CACHEDEV1_DATA/.qpkg/autosub/autosub-bootstrapbill/config.properties -d -l"
- case "$1" in
- start)
- echo "Starting $QPKG_NAME"
- if [ `/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf` = UNKNOWN ]; then
- /sbin/setcfg ${QPKG_NAME} Enable TRUE -f /etc/config/qpkg.conf
- elif [ `/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf` != TRUE ]; then
- echo "${QPKG_NAME} is disabled."
- exit 1
- fi
- #echo $(whoami) >> /share/CACHEDEV1_DATA/.qpkg/autosub/info.txt
- #echo ${DAEMON} >> /share/CACHEDEV1_DATA/.qpkg/autosub/info.txt
- #echo ${DAEMON_OPTS} >> /share/CACHEDEV1_DATA/.qpkg/autosub/info.txt
- ${DAEMON} ${DAEMON_OPTS} > /share/CACHEDEV1_DATA/.qpkg/autosub/info2
- #/opt/bin/python /share/CACHEDEV1_DATA/.qpkg/autosub/autosub-bootstrapbill/AutoSub.py -c /share/CACHEDEV1_DATA/.qpkg/autosub/autosub-bootstrapbill/config.properties -d > /share/CACHEDEV1_DATA/.qpkg/autosub/info2
- ;;
- stop)
- echo "Stopping $QPKG_NAME"
- for pid in $(/bin/pidof python); do
- /bin/grep -q "AutoSub.py" /proc/$pid/cmdline && /bin/kill $pid
- done
- /bin/sleep 2
- ;;
- restart|force-reload)
- echo "Restarting $QPKG_NAME"
- $0 stop
- $0 start
- ;;
- *)
- N=/etc/init.d/$QPKG_NAME
- echo "Usage: $N {start|stop|restart|force-reload}" >&2
- exit 1
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment