Linux version on the server is Centos 7.0.

Teamspeak server runs with this command:

./opt/teamspeak3-server_linux-x86/ts3server_startscript.sh start

My server doesn't have 100% uptime. Therefore, I want the server program to start automatically using a non root user.


Found this solution:

crontab -e
@reboot /opt/teamspeak3-server_linux-x86/ts3server_startscript.sh restart

If you do not require root privileges at all to start the server, you can use something like

sudo -u <username> ./opt/teamspeak3-server_linux-x86/ts3server_startscript.sh start

to start it as user <username>.

This command line must be placed in a file that is executed during startup.

IIRC there is a file for local stuff named somewhat like 99-local in /etc/init.d/. If not, you could write one yourself using some other startup file as template. To schedule the file for being run during startup, use the following command:

chkconfig --level 345 <your file name> on

whereas <your file name> is relative to /etc/init.d/.

Please note that you should specify sudo with its full path (eg. /usr/bin/sudo) to prevent the possibility of executing another version of sudo placed somewhere in the search path and you should resolve the . in ./opt/... (if executed from the root directory, it would be /opt/...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.