LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-27-2017, 08:59 PM   #1
PancakePutin
LQ Newbie
 
Registered: Jun 2017
Posts: 4

Rep: Reputation: Disabled
How do I make a program run on startup (and as a root)


I've been working on setting up a Teamspeak server for a couple days now, with no problems. My problem is that if the computer shuts down (power outage) I have to keep re-running the program manually and was wanting a script or program that would run automatically on start-up that would run a specific program as a root. (The program I'm trying to run is called "ts3server_minimal_runscript.sh")

Thanks

Edit: (I'm using Linux Mint 18.1 Cinnamon edition)

Last edited by PancakePutin; 06-27-2017 at 10:12 PM.
 
Old 06-27-2017, 09:14 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
You will need to add to the init system of your distribution. Have you tried looking at the website for Teamspeak? They probably would have this as an option in the doco.
 
Old 06-27-2017, 09:44 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,311
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
The classic solution would be to put it in rc.local, but it would help to know what distro/version you are running.
 
1 members found this post helpful.
Old 06-27-2017, 09:58 PM   #4
PancakePutin
LQ Newbie
 
Registered: Jun 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Grail, I checked teamspeak's website and their's nothing there about my problem.

Frankbell, other people had suggested that also, but i can't seem to find the rc.local folder anywhere (even in the etc folder).

Last edited by PancakePutin; 06-27-2017 at 10:00 PM.
 
Old 06-27-2017, 10:08 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,311
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
What distro/version are you using? That information would go a long way to enabling persons to help you with this issue.
 
Old 06-27-2017, 10:12 PM   #6
PancakePutin
LQ Newbie
 
Registered: Jun 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Frankbell, im using Linun Mint 18.1 Cinnamon edition.
 
Old 06-28-2017, 02:38 AM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Looks like you are on a systemd based system. From what I can see a service file should have come with the installation.
So depending on if there is or not:

Check and using systemd: https://wiki.archlinux.org/index.php/TeamSpeak

Create your own startup file: https://unix.stackexchange.com/quest...d-under-ubuntu

See how you go
 
Old 06-28-2017, 03:45 AM   #8
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
Originally Posted by PancakePutin View Post
Frankbell, other people had suggested that also, but i can't seem to find the rc.local folder anywhere (even in the etc folder).
rc.local is just a file, not a directory. On Mint, it is usually an executable file in /etc. Ok, if you can't find it there, try looking in /etc/init.d

You can add a few lines of code to call your TeamSpeak script at the end of rc.local.
 
Old 06-28-2017, 07:59 AM   #9
PancakePutin
LQ Newbie
 
Registered: Jun 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
aragron2101, I found rc.local in the init.d folder. (I know how stupid this sounds) What lines of code could I add to make it work? (the location of the file is "/home/hp/usr/bin/teammspeak3-server_linux_amd64/ts3server_minimal_runscript.sh")
 
Old 06-28-2017, 08:04 AM   #10
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
http://www.linuxquestions.org/questi...7/#post5371659
 
  


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
[SOLVED] Can run program as root but get dependency issues as non-root user everyday Linux - Software 9 10-26-2015 08:47 PM
[SOLVED] User permitted to run command,execute program as root and after execution, exit root vjlxmi Linux - Newbie 12 04-17-2015 06:30 AM
How to run a program as root on startup in debian wheezy? skilo47 Linux - Software 2 01-10-2014 11:20 AM
How to make a program run background when startup with rc gbao256 Linux - Newbie 2 12-18-2012 07:50 AM
how can i run a java program with root privilages from a non-root account? joyjjs Linux - Software 1 08-04-2009 12:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:39 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