Forked from leowinterde/TeamSpeak 3 Server - Autostart Service Script (LSBInitScript
Created
February 5, 2018 09:51
-
-
Save erwinowak/6cf46fd13eaff9de238c02b2a42bafb9 to your computer and use it in GitHub Desktop.
TeamSpeak 3 Server - Autostart Service Script (LSBInitScript)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## TeamSpeak 3 Server - Autostart Service Script (LSBInitScript) ## | |
| Init file: "/etc/init.d/tsserver" | |
| Runtime user: "ts" | |
| TeamSpeak server dir: "/home/ts/teamspeak3-server/<your tsserver>" | |
| Install: "chmod 0755 /etc/init.d/tsserver && cd /etc/init.d/ && insserv tsserver && cd - > /dev/null" | |
| Autostart after reboot: "update-rc.d tsserver defaults" | |
| Usage: tsserver {start|stop|status|restart} "/etc/init.d/tsserver status" "service tsserver status" | |
| enjoy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: tsserver | |
| # Required-Start: $local_fs $remote_fs $network $syslog $named | |
| # Required-Stop: $local_fs $remote_fs $network $syslog $named | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # X-Interactive: true | |
| # Short-Description: TeamSpeak 3 Server | |
| # Description: Start the TeamSpeak 3 Server and associated services. | |
| ### END INIT INFO | |
| DESC="teamspeak 3 voice server" | |
| NAME=tsserver | |
| USER="ts" | |
| DIR="/home/ts/teamspeak3-server" | |
| SCRIPTNAME="${0##*/}" | |
| SCRIPTNAME="${SCRIPTNAME##[KS][0-9][0-9]}" | |
| ENV="env -i LANG=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | |
| case "$1" in | |
| start) | |
| echo "Starting $DESC" "$NAME" | |
| echo | |
| su - $USER -c "${DIR}/ts3server_startscript.sh start" | |
| ;; | |
| stop) | |
| echo "Stopping $DESC" "$NAME" | |
| echo | |
| su - $USER -c "${DIR}/ts3server_startscript.sh stop" | |
| ;; | |
| status) | |
| su - $USER -c "${DIR}/ts3server_startscript.sh status" | |
| exit $? | |
| ;; | |
| restart) | |
| echo "Restarting $DESC" "$NAME" | |
| echo | |
| su - $USER -c "${DIR}/ts3server_startscript.sh stop" | |
| su - $USER -c "${DIR}/ts3server_startscript.sh start" | |
| ;; | |
| *) | |
| echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2 | |
| exit 3 | |
| ;; | |
| esac | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment