LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-23-2012, 06:02 AM   #1
fnadde42
LQ Newbie
 
Registered: Jun 2012
Location: Umeå, Sweden
Distribution: Ubuntu Server
Posts: 2

Rep: Reputation: Disabled
Startup script on another user


Hello forum!
I have searched for this topic but found no good answer. I run a Teamspeak server on my Ubuntu servercomputer which my friends use. But once in a while the power goes down and when it comes back the computer restarts but the Teamspeak server does not.

I wonder if there is a way to execute the start command for the Teamspeak server in the rc.local in a way that makes the user "teamspeak" the one that holds the process .

Teamspeak start command is a little something like this:
Code:
/path/to/teamspeak/ts3server_startscript.sh start
I'm running Ubuntu server 11.10
 
Old 06-23-2012, 06:38 AM   #2
sleddog
Member
 
Registered: Jan 2002
Location: Labrador, Canada
Distribution: CentOS, Debian
Posts: 182

Rep: Reputation: 35
Perhaps something like this in rc.local

Code:
/usr/bin/sudo -u teamspeak /path/to/teamspeak/ts3server_startscript.sh start
Check the path to sudo...
 
Old 06-23-2012, 01:42 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Alternatively, the unconventionalities of ubuntu permitting:
Code:
su --command '/path/to/teamspeak/ts3server_startscript.sh start' --login teamspeak &
Notes:
  1. rc.local is run with root privileges so su can be used without supplying a password.
  2. Using su rather than sudo avoids reliance on the sudoers file.
  3. The --login option simulates what happens when teamspeak logs in. This is useful for example to set environment variables which are set during login but will hang rc.local if teamspeak's login process prompts for user input.
  4. The & ensures that rc.local continues, in case the su or ts startup commands do not return promptly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running part of startup script as a different user ccapone11 Linux - Newbie 8 07-20-2009 12:38 PM
where to get linux administrator script, ex: script to let's user change user info. hocheetiong Linux - Server 1 03-17-2008 12:06 AM
How do I run a startup script as a user other than root? Questor21 Linux - Software 4 04-08-2006 11:51 AM
How to run startup script/daemon as a user other than root? Akhran Debian 2 02-04-2006 01:20 AM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration