[PD] Starting a PD Patch on ubuntu-server on Boot/Startup Tutorial
mark edward grimm
meg156 at columbia.edu
Tue Nov 7 04:54:06 CET 2006
Thanks for the suggestions on this list. Took me a
couple days of messing around. The following worked
the best for me. Hope this helps someone in need!
mark
I put the following script named "pd_start" in
/etc/init.d/
################################# beginning of script
#############################
#! /bin/sh
# Check for missing binaries (stale symlinks should
not happen)
PD_BIN=/usr/bin/pd
test -x $PD_BIN || exit 5
case "$1" in
start)
echo -n "Starting PD"
## Start daemon with startproc(8). If this
fails
## the return value is set appropriately by
startproc.
/usr/bin/pd -nogui -noaudio \
-lib /usr/lib/pd/extra/zexy \
-lib /usr/lib/pd/extra/maxlib \
-path /usr/lib/pd/extra \
-path /home/mark \
/home/mark/netpd_server.pd &
;;
## mind the &!!
stop)
echo -n "Shutting down NetPd Server"
## Stop daemon with killproc(8) and it this
fails
## killproc sets the return value according to
LSB
kill 'cat /var/run/pd.pid'
;;
restart)
## Stop the service and regardless of whether
it was
## running or not, start it again
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
################################## end of script
#######################
Then I changed the permissions on the file:
$ sudo chmod 755 pd_start
Then I ran the following command:
$ sudo update-rc.d -f pd_start start 99 2 3 4 5 .
Where:
- start is the argument given to the script (start,
stop).
- 99 is the start order of the script (1 = first one,
99= last one)
- 2 3 4 5 are the runlevels to start
It is important NOT to forget the "." period at the
end! More info in /etc/rcS.d/README.
After hitting enter I get this:
Adding system startup for /etc/init.d/pd_start ...
/etc/rc2.d/S99pd_start -> ../init.d/pd_start
/etc/rc3.d/S99pd_start -> ../init.d/pd_start
/etc/rc4.d/S99pd_start -> ../init.d/pd_start
/etc/rc5.d/S99pd_start -> ../init.d/pd_start
Then I do this to stop my script at shutdown:
$ sudo update-rc.d -f pd_start reboot 90 0 6 .
It is important NOT to forget the "." period at the
end! After hitting enter I get this:
usage: update-rc.d [-n] [-f] <basename> remove
update-rc.d [-n] <basename> defaults [NN | sNN
kNN]
update-rc.d [-n] <basename> start|stop NN
runlvl [runlvl] [...] .
-n: not really
-f: force
Then I restart the server to see if it works!
$ sudo shutdown -r now
AND IT DOES!!!
To know which runlevel you are running, simply type
$ runlevel
more info about runlevels here :
http://oldfield.wattle.id.au/luv/boot.html#init
This 'HowTo' was compiled using a suggestion from
'samyboy' at:
http://ubuntu.wordpress.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/
and a thread from the 'pure-data' list at:
http://lists.puredata.info/pipermail/pd-list/2006-11/043742.html
____________________
mark edward grimm | m.f.a | ed.m
megrimm.net | socialmediagroup.org & .com
meg156 at columbia.edu | 585.509.8703
______________________________
More information about the Pd-list
mailing list