Advertisement
Guest User

oscam start stop

a guest
Jan 25th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #!/bin/bash
  2. ### BEGIN INIT INFO
  3. # Provides: oscam
  4. # Required-Start: $local_fs $network
  5. # Required-Stop: $local_fs $network
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: Init script for oscam
  9. ### END INIT INFO
  10.  
  11. . /lib/lsb/init-functions
  12.  
  13. NAME=oscafixe.x64
  14. DAEMON="/srv/oscafixe"
  15. PIDFILE=/tmp/.oscam/oscam.pid
  16. DAEMON_OPTS="-c /srv/oscafixe"
  17.  
  18. start() {
  19. echo -n "Starting daemon: "$NAME
  20. start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
  21. echo "."
  22. }
  23.  
  24. stop() {
  25. echo -n "Stopping daemon: "$NAME
  26. start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
  27. echo "."
  28. }
  29.  
  30. restart(){
  31. stop
  32. sleep 3
  33. start
  34. }
  35.  
  36. status(){
  37. pidof $DAEMON > /dev/null 2>&1
  38. RETVAL=$?
  39. if [ $RETVAL -ne 0 ]; then
  40. echo "$NAME is not running"
  41. exit $RETVAL
  42. else
  43. echo "$NAME is running"
  44. fi
  45. }
  46.  
  47. reload(){
  48. kill -1 $(cat $PIDFILE)
  49. RETVAL=$?
  50. if [ $RETVAL -eq 0 ]; then
  51. echo "$NAME reloading successfully"
  52. else
  53. echo "$NAME reloading failed"
  54. exit $RETVAL
  55. fi
  56. }
  57.  
  58. case "$1" in
  59. start)
  60. start
  61. ;;
  62. stop)
  63. stop
  64. ;;
  65. restart)
  66. restart
  67. ;;
  68. reload)
  69. reload
  70. ;;
  71. status)
  72. status
  73. ;;
  74. *)
  75. echo "Usage: $0 {start|stop|restart|reload|status}"
  76. exit 1
  77. esac
  78.  
  79. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement