From e40e15b5844bc49174d4798d710e264b97cdeaf4 Mon Sep 17 00:00:00 2001
From: Hans-Christoph Steiner <eighthave@users.sourceforge.net>
Date: Thu, 7 Dec 2006 02:47:41 +0000
Subject: fixed bug in overridding DAEMON in default/pd and added comments

svn path=/trunk/; revision=6682
---
 scripts/debian/default/pd |  3 +++
 scripts/debian/init.d/pd  | 13 +++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

(limited to 'scripts')

diff --git a/scripts/debian/default/pd b/scripts/debian/default/pd
index b6317dce..c8186b34 100644
--- a/scripts/debian/default/pd
+++ b/scripts/debian/default/pd
@@ -1,6 +1,9 @@
 # this needs to be "yes" for it to start automatically
 #RUNPDDAEMON=yes
 
+# if your Pd is installed elsewhere, set the correct location
+#DAEMON=/usr/local/bin/pd
+
 # load your patches here
 #OPTIONS="-open /home/hans/cvs/pure-data/doc/tutorials/networking/chat-server.pd"
 
diff --git a/scripts/debian/init.d/pd b/scripts/debian/init.d/pd
index 05ba46b0..3e44e392 100755
--- a/scripts/debian/init.d/pd
+++ b/scripts/debian/init.d/pd
@@ -30,9 +30,6 @@ DAEMON=/usr/bin/$NAME
 PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 
-# Gracefully exit if the package has been removed.
-test -x $DAEMON || exit 0
-
 # options
 RUNPDDAEMON=no
 USER=nobody
@@ -49,6 +46,9 @@ then
 	. /etc/default/$NAME
 fi
 
+# Gracefully exit if the package has been removed.
+test -x $DAEMON || exit 0
+
 if [ "$RUNPDDAEMON" != "yes" ];then
 	echo "Pd not configured to run as a daemon. Edit /etc/default/$NAME."
 	exit 1
@@ -60,6 +60,7 @@ then
   exit 1
 fi
 
+# this is meant for running Pd as a server, so it turns off everything
 PARAMS="-nogui -noaudio -nomidi $OPTIONS"
 
 # for the log file
@@ -69,7 +70,8 @@ DATE=`date +20%y-%m-%d_%H.%M.%S`
 #	Function that starts the daemon/service.
 #
 d_start() {
-#	 /bin/su - arw -c "/usr/bin/pd -nogui" > /tmp/pd-`date +20%y-%m-%d_%H.%M.%S`.log 2>&1 &
+# if you want a log, use this line (until Pd gets syslog support)
+#	 /bin/su - $USER -c "$DAEMON $PARAMS" > /tmp/pd-$DATE.log 2>&1 &
 	start-stop-daemon -v --start --quiet --background --make-pidfile \
 		 --chuid $USER --pidfile $PIDFILE --exec $DAEMON -- $PARAMS
 }
@@ -80,8 +82,7 @@ d_start() {
 d_stop() {
 	start-stop-daemon --stop --quiet --pidfile $PIDFILE \
 		--user $USER --name $NAME --retry 5
-#	 echo "quit;quit;quit;" | /usr/bin/pdsend $PORT
-#	 sleep 5
+# if you used the /bin/su command in d_start(), you need this to stop Pd:
 #	 /usr/bin/killall -KILL pd || echo "Warning: $DESC was not running"
 }
 
-- 
cgit v1.2.1