summaryrefslogtreecommitdiff
path: root/puredata
blob: ff61f208fd24104311425d990b45582b29ed84cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/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 $?