updated on Wed Jan 11 00:07:16 UTC 2012
[aur-mirror.git] / plexmediaserver / plexmediaserver.rc.d
blobdd1316d92b93d2d08396ad1992506a3da55a21b7
1 #!/bin/bash
3 PLEX_MEDIA_SERVER_USER=root
5 . /etc/conf.d/plexmediaserver
7 export PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
8 export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}"
9 export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
11 . /etc/rc.conf
12 . /etc/rc.d/functions
14 PID=`pidof -o %PPID /usr/lib/plexmediaserver/Plex\ Media\ Server`
16 case "$1" in
17 start)
18 stat_busy "Starting Plex Media Server"
19 [ -z "$PID" ] && su -c " /usr/lib/plexmediaserver/Plex\ Media\ Server > /var/log/plexmediaserver.log &" $PLEX_MEDIA_SERVER_USER
20 if [ $? -gt 0 ]; then
21 stat_fail
22 else
23 add_daemon plexmediaserver
24 stat_done
27 stop)
28 stat_busy "Stopping Plex Media Server"
29 [ ! -z "$PID" ] && kill $PID > /dev/null
30 if [ $? -gt 0 ]; then
31 stat_fail
32 else
33 rm_daemon plexmediaserver
34 stat_done
37 restart)
38 $0 stop
39 sleep 3
40 $0 start
43 echo "usage: $0 {start|stop|restart}"
44 ;; esac
45 exit 0