#!/bin/sh # # Start/stop PureData start-up file # # Tarim - June 2009 # # puredata starts the startup file if it exists # puredata stop - stops ALL pd processes from running # puredata status - reports running if ANY pd processes are found PureData="pd" StartUp="/root/startup.pd" running() { pidof "${PureData}" >/dev/null } start() { if running; then echo "${PureData} already running." 1>&2 return 1 else [ -f "${StartUp}" ] && { echo "Starting ${StartUp}..." 1>&2 cd /root aoss "$PureData" -nogui -nomidi -r 22050 -open "${StartUp}" -path /root/theground/traktools/rj -path /root/theground/traktools/WorldQuantizer.rj -path /root/theground/traktools/listtools & # 1>/dev/null 2>/dev/null & cd wim ./wim.py genttest.xml -D } return 0 fi } stop() { killall -SIGINT wim.py sleep 1 killall -SIGTERM wim.py 2>/dev/null echo "Stopping ${PureData}..." 1>&2 killall -SIGINT "${PureData}" sleep 1 killall -SIGTERM "${PureData}" 2>/dev/null return 0 } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) if running; then echo "${PureData} running." exit 0 else echo "${PureData} not running." exit 1 fi ;; *) echo "Usage: $0 {start | stop | restart | status}" 1>&2 exit 2 esac exit $?