So heres my problem:
I have installed a python script called "plexcoect" which is basicly a script to trick my apple tv3 in to looking elsewhere for its trailers.
More information here: https://github.com/iBaa/PlexCoect
Then theres another script that makes a deamon of this.
Source: https://forums.plex.tv/discussion/15...-ubuntu-server
The (minor) problem i have with this deamon is after a reboot the service allways start as:
Active (exited)
after a service restart its
Active (ruing)
And then everything is just dandy!
So my question is: Can anyone give me a clue to why that is? Code for deamon:
Code:
#!/bin/bash ### BEGIN INIT INFO # Provides: plexcoect # Required-Start: networking # Required-Stop: networking # Default-Start: 3 4 5 # Default-Stop: 0 1 6 # Short-Description: This is the Plex Coect daemon # Description: This script starts the Plex Coect # Python scripts in a detached screen. ### END INIT INFO # Using the lsb functions to perform the operations. ./lib/lsb/init-functions # Process name ( For display ) NAME=PlexCoect # Daemon name, where is the actual executable DAEMON="/usr/bin/screen" DAEMON_OPTS="-S PlexCoect -d -m /usr/local/lib/PlexCoect/PlexCoect.py" DAEMON_USER="root" # pid file for the daemon PIDFILE=/var/run/PlexCoect.pid # If the daemon is not there, then exit. test -x "$DAEMON"||exit5 case $1 in start) # Checked the PID file exists and check the actual status of process if[-e $PIDFILE ];then status_of_proc -p $PIDFILE "$DAEMON $DAEMON_OPTS""$NAME process"&& status="0"|| status="$?" # If the status is SUCCESS then don't need to start again. if[ $?="0"];then log_success_msg "Starting the process $NAME" exit# Exit fi fi # Start the daemon. # Start the daemon with the help of start-stop-daemon # Log the message appropriately if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -p $PIDFILE -- ${DAEMON_OPTS};then while read line ;do[[ $line =~([0-9]*).PlexCoect]]&& echo ${BASH_REMATCH[1]};done<<(screen -ls)> $PIDFILE log_success_msg "Starting the process $NAME" else log_failure_msg "Starting the process $NAME" fi ;; stop) # Stop the daemon. if[-e $PIDFILE ];then status_of_proc -p $PIDFILE "$DAEMON DAEMON_OPTS""Stoppping the $NAME process"&& status="0"|| status="$?" if["$?"=0];then start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE /bin/rm -rf $PIDFILE log_success_msg ""Stopping the $NAME process"" fi else log_failure_msg "$NAME process is not ruing" fi ;; restart) # Restart the daemon. $0 stop && sleep 2&& $0 start ;; status) # Check the status of the process. if[-e $PIDFILE ];then status_of_proc -p $PIDFILE "$DAEMON $DAEMON_OPTS""$NAME process"&&exit0||exit $? log_success_msg "$NAME process is ruing" else log_failure_msg "$NAME process is not ruing" fi ;; reload) $0 restart ;; *) # For invalid arguments, print the usage message. echo "Usage: $0 {start|stop|restart|reload|status}" exit2 ;; esac
برچسب:
نویسنده: استخدام کار