Guest User

autosub script

a guest
Jun 27th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: Auto-sub application instance
  4. # Required-Start: $all
  5. # Required-Stop: $all
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: starts instance of Auto-sub
  9. # Description: starts instance of Auto-sub using start-stop-daemon
  10. ### END INIT INFO
  11. ############### EDIT ME ##################
  12. QPKG_NAME=AutoSub
  13. QPKG_DIR=$(/sbin/getcfg $QPKG_NAME Install_Path -f /etc/config/qpkg.conf)
  14. DAEMON=/opt/bin/python2.7
  15. DAEMON_OPTS="/share/CACHEDEV1_DATA/.qpkg/autosub/autosub-bootstrapbill/AutoSub.py -c /share/CACHEDEV1_DATA/.qpkg/autosub/autosub-bootstrapbill/config.properties -d -l"
  16. case "$1" in
  17. start)
  18. echo "Starting $QPKG_NAME"
  19. if [ `/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf` = UNKNOWN ]; then
  20. /sbin/setcfg ${QPKG_NAME} Enable TRUE -f /etc/config/qpkg.conf
  21. elif [ `/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf` != TRUE ]; then
  22. echo "${QPKG_NAME} is disabled."
  23. exit 1
  24. fi
  25. #echo $(whoami) >> /share/CACHEDEV1_DATA/.qpkg/autosub/info.txt
  26. #echo ${DAEMON} >> /share/CACHEDEV1_DATA/.qpkg/autosub/info.txt
  27. #echo ${DAEMON_OPTS} >> /share/CACHEDEV1_DATA/.qpkg/autosub/info.txt
  28. ${DAEMON} ${DAEMON_OPTS} > /share/CACHEDEV1_DATA/.qpkg/autosub/info2
  29. #/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
  30. ;;
  31. stop)
  32. echo "Stopping $QPKG_NAME"
  33. for pid in $(/bin/pidof python); do
  34. /bin/grep -q "AutoSub.py" /proc/$pid/cmdline && /bin/kill $pid
  35. done
  36. /bin/sleep 2
  37. ;;
  38. restart|force-reload)
  39. echo "Restarting $QPKG_NAME"
  40. $0 stop
  41. $0 start
  42. ;;
  43. *)
  44. N=/etc/init.d/$QPKG_NAME
  45. echo "Usage: $N {start|stop|restart|force-reload}" >&2
  46. exit 1
  47. ;;
  48. esac
  49. exit 0
Advertisement
Add Comment
Please, Sign In to add comment