hey all,
...relative newbie at the linux stuff so..
I'm trying to run a patch when the system boots (at the end of my boot cycle) so all I will have to do is plug in the system, turn it on and everything will boot..
I took a look at this thread: http://lists.puredata.info/pipermail/pd-list/2004-10/022984.html
and gave it a whirl with no luck on ubuntu... it seems like there should be an easier way to do this.
I have a patch in my home folder so "~/FOO.PATCH.pd" and my script is in my home folder "~/FOO_PATCH.sh"
if i type "sh ~/FOO_PATCH.sh" anywhere it boots pd, my libs, and my patch fine. BTW my pd launch tags:
pd -nogui -noaudio -lib zexy -lib maxlib -open ~/FOO_PATCH.pd
So I should just be able to reference the the "~/FOO_PATCH.sh" at the end of my booting and pd and the patch should load correct?
I search the internet as to where and how to do this but alas have failed!
Am I doing this correctly? I tried inserting a line like "sh ~/FOO_PATCH.sh" in rc.local with no luck. And I've tried a couple other things with no luck either...
Hopefully I was clear enough...
I if I get it to work I will do a little write up so that other newbies like me can do this...
cheers mark
mark edward grimm | m.f.a | ed.m
megrimm.net | socialmediagroup.org & .com
meg156@columbia.edu | 585.509.8703
______________________________
ola,
Am I doing this correctly? I tried inserting a line like "sh ~/FOO_PATCH.sh" in rc.local with no luck. And I've tried a couple other things with no luck either...
yes, because he doesn't know what ~ means at that stage, put rather :
/home/<username>/FOO_PATCH.sh
and it should start.
suerte, sevy
Hi Mark,
mark edward grimm wrote:
I took a look at this thread: http://lists.puredata.info/pipermail/pd-list/2004-10/022984.html
and gave it a whirl with no luck on ubuntu... it seems like there should be an easier way to do this.
I took a bunch of notes from various sources on this. Almost all are from posts on the PD list, however I don't have the authors names attached anymore. Apologies to the original posters!
But anyway, you should be able to find a solution somewhere in these suggestions! It largely depends on whether or not you are running X (which I imagine on a server you are not!)
best, d.
to autostart on linux
put a symlink in your rc3.d (or with whatever runlevel you boot by default, this is set in /etc/inittab)
called S19pd_start (any number, but be sure, all other important processes are started before/lower numbers...) to a script named pd_start
linux then calls this script with the argument "start" when booting. the script "pd_start" looks like:
################################# beginning of script #############################
#! /bin/sh
# Check for missing binaries (stale symlinks should not happen) PD_BIN=/usr/local/pd/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/local/pd/bin/pd -nogui -noadc -audiobuf 20 -r 22050
-lib /usr/local/lib/pd/pdp/pdp
-lib /usr/local/lib/pd/externs/zexy
-path /home/marius
-path /usr/local/lib/pd/pdp
-path /usr/local/lib/pd/externs/zexy
/home/marius/application.pd &
;;
## mind the &!!!
stop)
echo -n "Shutting down FOO "
## Stop daemon with killproc(8) and if 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 #######################
-- /etc/rc.d/rc.local: #!/bin/sh echo -n "starting pd..." PATH=/sbin:/bin:/usr/sbin:/usr/bin /usr/local/bin/pd_start
thanks derek!
This all looks very promising! I will try some of this later tonight and i will let the list know what works... (unless someone already knows what works:)
...no im not running X. its optimized to run with just a power cord and and network cord :)
best mark
--- derek holzer derek@x-i.net wrote:
Hi Mark,
mark edward grimm wrote:
I took a look at this thread:
http://lists.puredata.info/pipermail/pd-list/2004-10/022984.html
and gave it a whirl with no luck on ubuntu... it
seems
like there should be an easier way to do this.
I took a bunch of notes from various sources on this. Almost all are from posts on the PD list, however I don't have the authors names attached anymore. Apologies to the original posters!
But anyway, you should be able to find a solution somewhere in these suggestions! It largely depends on whether or not you are running X (which I imagine on a server you are not!)
best, d.
to autostart on linux
put a symlink in your rc3.d (or with whatever runlevel you boot by default, this is set in /etc/inittab)
called S19pd_start (any number, but be sure, all other important processes are started before/lower numbers...) to a script named pd_start
linux then calls this script with the argument "start" when booting. the script "pd_start" looks like:
################################# beginning of script #############################
#! /bin/sh
# Check for missing binaries (stale symlinks should not happen) PD_BIN=/usr/local/pd/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/local/pd/bin/pd -nogui -noadc -audiobuf 20 -r 22050
-lib /usr/local/lib/pd/pdp/pdp
-lib /usr/local/lib/pd/externs/zexy
-path /home/marius
-path /usr/local/lib/pd/pdp
-path /usr/local/lib/pd/externs/zexy
/home/marius/application.pd & ;; ## mind the &!!! stop) echo -n "Shutting down FOO " ## Stop daemon with killproc(8) and if 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 #######################
-- /etc/rc.d/rc.local: #!/bin/sh echo -n "starting pd..." PATH=/sbin:/bin:/usr/sbin:/usr/bin /usr/local/bin/pd_start --
-- /usr/local/bin/pd_start: #! /bin/sh echo -n "starting pd..." PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin cd /home/glui pd -verbose -nogui -nomidi
-lib /usr/lib/pd/extra/OSC
-lib /usr/lib/pd/extra/zexy
-open /home/glui/proj/LIDARmacher/pd/GPlayerStereo.pd & --########################
make an ".xinitrc" file in your home directory. in it put something like:
hdspmixer &
you can also safely put other stuff in there if you like:
jackd -d alsa & pd -jack mypathc.pd & xterm
but you might be better off doing this in some other star script and killing X after you know hdspmixer has been run.
you only need to run hdspmixer once - this initializes the card somehow.
to login to X automagically
use mingetty on tty1 with the option --autologin you set that in /etc/inittab
mine says this: 1:2345:respawn:/sbin/getty 38400 tty1
change it to something like this: 1:2345:respawn:/sbin/mingetty --autologin myusername tty1
where "myusername" is the name you want to log into.
then in .bash_profile under "myusername", you'll want somthing to automatically startx, like this:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then startx fi
###################
Using this script you can run Pd as a daemon:
scripts/debian/init.d/pd
That means you can do this kind of stuff:
/etc/init.d/pd start /etc/init.d/pd stop /etc/init.d/pd restart
You'll most likely need to use it in -nogui mode, but it does that by default. You can configure which user account pd runs
=== message truncated ===
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:
stop).
99= last one)
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-...
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@columbia.edu | 585.509.8703
______________________________
hi mark
this is great!!! thanks a lot for sharing your work!
grz roman
On Mon, 2006-11-06 at 19:54 -0800, mark edward grimm wrote:
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 LSBkill '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-...
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@columbia.edu | 585.509.8703 ______________________________
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de