Ubuntu service script
#1
Posted 14 May 2011 - 05:04 PM
#2
Posted 14 May 2011 - 06:52 PM
do this:
sudo nano /etc/init/plexpms.conf
Paste the following into the file - you'll have to modify it with the path to wherever you put your PMS folder. Also notice at the end of the "su" line change "tvs" to the name of the user you want to execute PMS as.
# plexpms - service job file
description "Plex PMS"
author "Plex Gods"
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Sets nice and ionice level for job
nice -5
# What to execute
script
cd /home/tvs/PlexMediaServer
su -c ./start.sh tvs
end scriptNow PMS will start at system boot running as user "tvs" and will be stopped prior to system shutdown.
You can stop the service manually by:
sudo service plexpms stop
or start it manually by
sudo service plexpms start
Enjoy!
#3
Posted 14 May 2011 - 07:31 PM
#4
Posted 14 May 2011 - 07:43 PM
Plex for iOS on: iPad & iPhone 4
Plex Media Server on: Ubuntu 12.10
#5
Posted 14 May 2011 - 07:56 PM
Thanks!
#6
Posted 14 May 2011 - 07:57 PM
Plex for iOS on: iPad & iPhone 4
Plex Media Server on: Ubuntu 12.10
#7
Posted 14 May 2011 - 08:08 PM
Thank you, too, Fevida for the fast reply
#8
Posted 14 May 2011 - 09:11 PM
#10
Posted 15 May 2011 - 09:17 AM
Units Owned: Roku 1 XD, Roku 2 XS
#11
Posted 20 May 2011 - 06:54 AM
#12
Posted 20 May 2011 - 08:40 AM
Instagram: @elan
The Plex blog.
The wife's photography site.
The brother's photography blog.
The dog's twitter feed.
#13
Posted 25 June 2011 - 01:46 PM
I've updated the top post with the nice stanza.
On a related note I set sabnzbd which also runs on this machine to a lower priority to keep it from interfering when it's doing its par2 and unrar stuff (fairly io intensive).
#14
Posted 25 June 2011 - 02:09 PM
On a related note I set sabnzbd which also runs on this machine to a lower priority to keep it from interfering when it's doing its par2 and unrar stuff (fairly io intensive).
Does it help? If I'm watching a movie and sab starts unpacking the movie stutters like hell.
Could you also describe how I can do that?
#15
Posted 25 June 2011 - 05:54 PM
Does it help? If I'm watching a movie and sab starts unpacking the movie stutters like hell.
![]()
Could you also describe how I can do that?
Yes, it definitely will help. Check out this thread over on the Sab forums: http://forums.sabnzb...hp?topic=5052.0
#16
Posted 11 July 2011 - 02:41 AM
sudo service plexmediaserver start
I'm seeing this error in syslog when I change the user in the script to a system user (in my case I created a user called plex)
plexmediaserver main process (3236) terminated with status 1
I'm seeing this error in syslog when I add my normal login to the script above (I tried this as I am able to start up plex manually with no problem)
plexmediaserver main process (3364) terminated with status 127
Any thoughts on what might be causing this? I haven't been able to find any information on upstart status codes. Thanks again!
#17
Posted 13 July 2011 - 12:06 PM
Hey puithove, awesome upstart script. I'm having a little trouble getting plex to start up. I have no problems running the start.sh script, but when I try to run
I'm definitely no expert here. Let's start with the basics and get those out of the way:
- You say you can run it manually by launching the start.sh script - what user are you logged in with when you do that? Is it the same "plex" user you're specifying in the service config file?
- Are you able to launch the start.sh script as user "plex" - if not, what error do you get?
- You say you then changed the config to start as your normal login - but did you leave the "cd <path>" statement pointing to the actual plexmediaserver directory?
#18
Posted 14 July 2011 - 03:50 AM
Thanks!!
#19
Posted 14 July 2011 - 03:53 PM
I think you may be correct, I am using the plex user in the script, however I'm unable to su to the plex user (because it is a system user with no shell). The upstart script probably has the same issue... it can't su to plex. I'll try a non-system user and see if that works. I'd like to avoid creating a new potential login (I thought thats how system users worked) but it may not be possible in this case??
Thanks!!
Ah, well I think that because of the way the PMS is running, it needs a real user. Get it set up and running as the user you want to run it under, and then I expect the Upstart piece will work fine for you. You won't have to be "logged in" as that user all the time, Upstart will start it as that user running as a service so it'll start when the system boots without having to log in.
#20
Posted 24 July 2011 - 09:54 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











