[PD] pd-extended 0.43.3/ raspberry pi (wheezy) - start patch on boot?

Hans-Christoph Steiner hans at at.or.at
Mon Nov 26 03:33:50 CET 2012


I found a bug in the script.  I fixed it and committed the fix.  I attached it
here as well.  Copy this to /etc/init.d and try again.

.hc

On 11/25/2012 12:11 PM, Epic Jefferson wrote:
> Hans:
> 
> to make sure i had everything correct i started from scratch,
> i did everything you indicated including the exact patch location, still
> nothing.
> i added the auto login as suggested by Cyrille, nada.
> 
> Cyrille:
> could you be more specific as to what i would replace the startx with?
> should i indicate the exact path as well?
> 
> like so: su pi -c /home/pi/Desktop/whatever.pd
> 
> i tested it with startx and it did not work anyway.
> 
> 
> On Sun, Nov 25, 2012 at 4:14 AM, Cyrille Henry <ch at chnry.net> wrote:
> 
>> hello,
>>
>> to start a patch on a RPi, you can also follow this instruction :
>> http://elinux.org/RPi_Debian_**Auto_Login<http://elinux.org/RPi_Debian_Auto_Login>
>>
>> once autologin work, you can replace the startX by pd.
>>
>> works for me.
>> cheers
>> c
>>
>>
>> Le 25/11/2012 06:10, Epic Jefferson a écrit :
>>
>>> Charles:
>>>
>>> i found /etc/init.d/pd-extended and added
>>>
>>> su -c "pd whetever.pd" pi
>>>
>>> (am i supposed to specify the exact location of the patch?
>>>   /home/pi/Desktop/pd/whatever.**pd)
>>>
>>> then
>>> $ chmod a+x /etc/init.d/pd-extended
>>> $ update-rc.d pd-extended defaults 99
>>>
>>> i rebooted but no pd patch on startup
>>>
>>> Hans:
>>> i also tried editing /etc/default/pd-extended by un-commenting
>>> RUNPDDAEMON=yes
>>> DAEMON=/usr/bin/pd-extended
>>> and i set the patch location
>>> and the user: USER=pi
>>>
>>> still nothing on start up. perhaps there is a conflict between Charles'
>>> and Hans' instructions?
>>>
>>>
>>> On Sat, Nov 24, 2012 at 9:37 PM, Hans-Christoph Steiner <hans at at.or.at<mailto:
>>> hans at at.or.at>> wrote:
>>>
>>>
>>>     On Nov 24, 2012, at 6:49 PM, Charles Goyard wrote:
>>>
>>>      > Epic Jefferson wrote:
>>>      >> i'd like to start a patch automatically upon booting. is there a
>>> file i can
>>>      >> edit to load a whatever.pd patch by the end of the start up
>>> sequence? GUI
>>>      >> is not required.
>>>      >
>>>      > Create a script named /etc/init.d/pdauto containing :
>>>      >
>>>      > #!/bin/sh
>>>      > su -c "pd mypatch.pd" your_username
>>>      >
>>>      > Make it executable : chmod a+x /etc/init.d/pdauto
>>>      >
>>>      > Then run :
>>>      > update-rc.d pdauto defaults 99
>>>      > to make it run at startup
>>>      >
>>>      > See 11.6 in
>>>      > http://www.debian.org/doc/**manuals/debian-faq/ch-**
>>> customizing.en.html<http://www.debian.org/doc/manuals/debian-faq/ch-customizing.en.html>
>>>      > for more details.
>>>
>>>     Pd-extended Debian packages should install /etc/init.d/pd, otherwise
>>> you can get it from pure-data SVN: trunk/scripts/debian.
>>>
>>>     Edit /etc/default/pd to change the startup options.
>>>
>>>     .hc
>>>
>>>
>>>
>>>     ______________________________**_________________
>>>     Pd-list at iem.at <mailto:Pd-list at iem.at> mailing list
>>>
>>>     UNSUBSCRIBE and account-management -> http://lists.puredata.info/**
>>> listinfo/pd-list <http://lists.puredata.info/listinfo/pd-list>
>>>
>>>
>>>
>>>
>>> --
>>> www.epicjefferson.com <http://www.epicjefferson.com>
>>> www.avmachinists.org <http://www.avmachinists.org> Puerto Rico based Art
>>> Collective/ Non-Profit Org
>>>
>>>
>>>
>>> ______________________________**_________________
>>> Pd-list at iem.at mailing list
>>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/**
>>> listinfo/pd-list <http://lists.puredata.info/listinfo/pd-list>
>>>
>>>
> 
> 
-------------- next part --------------
#! /bin/sh
### BEGIN INIT INFO
# Provides:          pd
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0
# Short-Description: Pure Data
# Description:       Pure Data realtime graphical programming environment.
### END INIT INFO

# Author: Hans-Christoph Steiner <hans at eds.org>

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Pd-extended"
NAME=pd-extended
DAEMON=/usr/bin/$NAME
#DAEMON_ARGS="--options args"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# options
RUNPDDAEMON=no
USER=nobody
#PORT=34985

# this is meant for running Pd as a server, so it turns off everything
PARAMS="-nogui -noaudio -nomidi $OPTIONS"

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start() {
# 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
}

#
# Function that stops the daemon/service
#
do_stop()
{
	# Return
	#   0 if daemon has been stopped
	#   1 if daemon was already stopped
	#   2 if daemon could not be stopped
	#   other if a failure occurred
	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
	RETVAL="$?"
	[ "$RETVAL" = 2 ] && return 2
	# Wait for children to finish too if this is a daemon that forks
	# and if the daemon is only ever run from this initscript.
	# If the above conditions are not satisfied then add some other code
	# that waits for the process to drop all resources that could be
	# needed by services started subsequently.  A last resort is to
	# sleep for some time.
	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
	[ "$?" = 2 ] && return 2
	# Many daemons don't delete their pidfiles when they exit.
	rm -f $PIDFILE
	return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
	#
	# If the daemon can reload its configuration without
	# restarting (for example, when it is sent a SIGHUP),
	# then implement that here.
	#
	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
	return 0
}

case "$1" in
  start)
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
	do_start
	case "$?" in
		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
	esac
	;;
  stop)
	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
	do_stop
	case "$?" in
		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
	esac
	;;
  #reload|force-reload)
	#
	# If do_reload() is not implemented then leave this commented out
	# and leave 'force-reload' as an alias for 'restart'.
	#
	#log_daemon_msg "Reloading $DESC" "$NAME"
	#do_reload
	#log_end_msg $?
	#;;
  restart|force-reload)
	#
	# If the "reload" option is implemented then remove the
	# 'force-reload' alias
	#
	log_daemon_msg "Restarting $DESC" "$NAME"
	do_stop
	case "$?" in
	  0|1)
		do_start
		case "$?" in
			0) log_end_msg 0 ;;
			1) log_end_msg 1 ;; # Old process is still running
			*) log_end_msg 1 ;; # Failed to start
		esac
		;;
	  *)
	  	# Failed to stop
		log_end_msg 1
		;;
	esac
	;;
  *)
	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 3
	;;
esac

:


More information about the Pd-list mailing list