Advertisement
Guest User

root

a guest
Dec 23rd, 2009
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. #!/bin/bash
  2. # Teamspeak3 Server Startscript - written by email@zeitsofa.de
  3. # This is a small startscript for your teamspeak3 server
  4. # This script was published under GPL ;)
  5. # Have a lot of fun to edit and modify this script.
  6. # Set up your own setting in configuration part of script below
  7.  
  8. ### CONFIGURATION PART ###
  9.  
  10. # Daemon User - As which user TS3 should run?
  11. DAEMON_USER="teamspeak"
  12. # A little Description (Don't need to edit)
  13. DESC="Teamspeak Server 3"
  14. # Homedir from your TS3 (your TS3 root dir)
  15. DIR=/home/teamspeak/ts3
  16. # Which arch is your TS3? (x86 or amd64)
  17. ARCH=x86
  18. # TS3 bin file (Don't need to edit)
  19. BIN=ts3server_linux_$ARCH
  20. # Your pidfile
  21. PID=tsserver3.pid
  22. # Type your own parameters to start TS3 (last parameter have to by a &)
  23. PARAMS="&"
  24.  
  25. ## Below you down need to edit anything
  26.  
  27. DAEMON=$DIR/$BIN
  28. PATH=$DIR:/bin:/usr/bin:/sbin:/usr/sbin
  29.  
  30. ### MAIN PART ###
  31.  
  32.  
  33. test -x $DAEMON || echo "Daemon not found in $DIR. Please check your BIN and DIR parts in $0"
  34.  
  35. case "$1" in
  36. start)
  37. echo "Start of $DESC"
  38. if [ $(pidof $BIN) ]
  39. then
  40. echo "$DESC is running! Nothing to do!"
  41. exit 1
  42. else
  43. cd $DIR
  44. su $DAEMON_USER -c "$DAEMON $PARAMS" &> /dev/null
  45. echo $(pidof $BIN) > $PID
  46. echo "$DESC started successfully"
  47. exit 0
  48. fi
  49. ;;
  50.  
  51.  
  52. stop)
  53. echo "Stop $DESC"
  54. if [ ! $(pidof $BIN) ]
  55. then
  56. echo "$DESC is not running! Nothing to do!"
  57. exit 1
  58. else
  59. kill -TERM $(pidof $BIN)
  60. echo "$DESC stopped successfully"
  61. exit 0
  62. fi
  63. ;;
  64.  
  65. restart)
  66. $0 stop
  67. sleep 1
  68. $0 start
  69. exit 0
  70. ;;
  71.  
  72. status)
  73. echo "Running Process from $DESC:"
  74. if [ ! $(pidof $BIN) ]
  75. then
  76. echo "===> no active process found!"
  77. exit 0
  78. else
  79. ps -lC $BIN --no-heading
  80. fi
  81. ;;
  82.  
  83. *)
  84. echo "Parameter: $0 {start|stop|status|restart}"
  85. exit 1
  86. ;;
  87. esac
  88.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement