mpsweb.servis 700 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. #
  3. # mpsweb servisi.
  4. BIN=/opt/mpsweb/mpsweb.py
  5. PID=/var/run/mpweb.pid
  6. DAEMON_USER=root
  7. mpsweb_start() {
  8. if [ -s $PID ]; then
  9. echo "mpsweb zaten calisiyor!"
  10. exit 1
  11. fi
  12. echo "mpsweb baslatiliyor..."
  13. if [ -x $BIN ]; then
  14. #$BIN & echo $! > $PID
  15. start-stop-daemon --start --background --pidfile $PID --startas $BIN --make-pidfile
  16. fi
  17. }
  18. mpsweb_stop() {
  19. echo "mpsweb kapatiliyor..."
  20. kill -9 $(cat $PID) && rm -rf $PID
  21. }
  22. mpsweb_restart() {
  23. mpsweb_stop
  24. sleep 3
  25. mpsweb_start
  26. }
  27. case "$1" in
  28. start)
  29. mpsweb_start
  30. ;;
  31. stop)
  32. mpsweb_stop
  33. ;;
  34. restart)
  35. mpsweb_restart
  36. ;;
  37. *)
  38. echo "kullanım: `basename $0` {start|stop|restart}"
  39. esac