Advertisement
Guest User

Untitled

a guest
Sep 14th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: ts3server
  4. # Required-Start: $remote_fs $syslog
  5. # Required-Stop: $remote_fs $syslog
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: TeamSpeak 3 Server
  9. # Description: Startup Init-Script for TeamSpeak 3 Server
  10. ### END INIT INFO
  11.  
  12. # PATH should only include /usr/* if it runs after the mountnfs.sh script
  13. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  14. DESC="TeamSpeak 3 Server"
  15. NAME=ts3server
  16. USER=teamspeak
  17. BINARY=ts3server
  18. BINARY_BIN=/usr/local/bin/teamspeak3-server_linux_amd64
  19. DAEMON=ts3server_startscript.sh
  20. DAEMON_ARGS=inifile=ts3server.ini
  21. PIDFILE=$BINARY_BIN/$NAME.pid
  22. SCRIPTNAME=/etc/init.d/$NAME
  23.  
  24. # Exit if the package is not installed
  25. [ -x "$BINARY_BIN/$DAEMON" ] || exit 0
  26.  
  27. # Define LSB log_* functions.
  28. # Depend on lsb-base (>= 3.2-14) to ensure that this file is presenthttp://dl.4players.de/ts/releases
  29. # and status_of_proc is working.
  30. . /lib/lsb/init-functions
  31.  
  32. #
  33. # Function that starts the daemon/service
  34. #
  35. do_start()
  36. {
  37. su $USER -s /bin/sh -c "$BINARY_BIN/$DAEMON start $DAEMON_ARGS"
  38. }
  39.  
  40. #
  41. # Function that stops the daemon/service
  42. #
  43. do_stop()
  44. {
  45. su $USER -s /bin/sh -c "$BINARY_BIN/$DAEMON stop $DAEMON_ARGS"
  46. }
  47.  
  48. #
  49. # Function that shows the status of to the daemon/service
  50. #
  51. do_status()
  52. {
  53. su $USER -s /bin/sh -c "$BINARY_BIN/$DAEMON status $DAEMON_ARGS"
  54. }
  55.  
  56. case "$1" in
  57. start)
  58. log_daemon_msg "Starting $DESC" ""
  59. do_start
  60. case "$?" in
  61. 0|1) log_end_msg 0 ;;
  62. 2) log_end_msg 1 ;;
  63. esac
  64. ;;
  65. stop)
  66. log_daemon_msg "Stopping $DESC" ""
  67. do_stop
  68. case "$?" in
  69. 0|1) log_end_msg 0 ;;
  70. 2) log_end_msg 1 ;;
  71. esac
  72. ;;
  73. status)
  74. do_status
  75. status_of_proc "$BINARY" "$DESC" && exit 0 || exit $?
  76. ;;
  77. restart)
  78. log_daemon_msg "Restarting $DESC" ""
  79. do_stop
  80. case "$?" in
  81. 0|1)
  82. do_start
  83. case "$?" in
  84. 0) log_end_msg 0 ;;
  85. 1) log_end_msg 1 ;; # Old process is still running
  86. *) log_end_msg 1 ;; # Failed to start
  87. esac
  88. ;;
  89. *)
  90. # Failed to stop
  91. log_end_msg 1
  92. ;;
  93. esac
  94. ;;
  95. *)
  96. echo "Usage: $SCRIPTNAME {start|stop|status|restart}"
  97. exit 3
  98. ;;
  99. esac
  100.  
  101. :
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement