Skip to content

Commit 7bdaee1

Browse files
committed
Add plotsurf daemon
1 parent 80fbe52 commit 7bdaee1

File tree

4 files changed

+65
-8
lines changed

4 files changed

+65
-8
lines changed

Diff for: launch.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/sh
22

3-
sudo cp surfboard.plist /Library/LaunchDaemons
3+
which=$1
44

5-
sudo launchctl load /Library/LaunchDaemons/surfboard.plist
5+
sudo cp $which.plist /Library/LaunchDaemons
66

7-
sudo launchctl list | fgrep surfboard
7+
sudo launchctl load /Library/LaunchDaemons/$which.plist
8+
9+
sudo launchctl list | fgrep $which
810

Diff for: plotsurf.plist

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
3+
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
4+
<plist version="1.0">
5+
<dict>
6+
<key>Label</key>
7+
<string>local.plotsurf</string>
8+
<key>UserName</key>
9+
<string>mom_dad</string>
10+
<key>EnvironmentVariables</key>
11+
<dict>
12+
<key>PATH</key>
13+
<string>/usr/local/bin:/bin:/usr/bin</string>
14+
</dict>
15+
<key>WorkingDirectory</key>
16+
<string>/Users/mom_dad/surfboard</string>
17+
<key>StandardErrorPath</key>
18+
<string>/Users/mom_dad/surfboard/plotsurf.stderr</string>
19+
<key>ProgramArguments</key>
20+
<array>
21+
<string>/bin/sh</string>
22+
<string>-c</string>
23+
<string>$HOME/git/surfboard/plotsurf.sh 2>> plotsurf.err</string>
24+
</array>
25+
26+
<key>StartCalendarInterval</key>
27+
<array>
28+
<dict>
29+
<key>Hour</key>
30+
<integer>1</integer>
31+
<key>Minute</key>
32+
<integer>0</integer>
33+
</dict>
34+
</array>
35+
</dict>
36+
</plist>

Diff for: plotsurf.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
in=$(mktemp /tmp/plotsurf_XXXXXX)
4+
out=$(mktemp /tmp/plotsurf_XXXXXX)
5+
echo $in $out
6+
7+
trap '{ rm $in $out; }' EXIT
8+
9+
cat > $in<< EOD
10+
png(file="$HOME/surfboard/plotsurf1.png")
11+
png(file="$HOME/surfboard/plotsurf2.png")
12+
plotsurf()
13+
EOD
14+
15+
R --slave --no-save CMD BATCH $in $out
16+
17+
[ $status ] && cat $out 1>&2

Diff for: unlaunch.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/sh
22

3-
sudo launchctl list | fgrep surfboard
4-
sudo launchctl stop local.surfboard
5-
sudo launchctl remove local.surfboard
6-
sudo launchctl list | fgrep surfboard
7-
sudo rm -f /Library/LaunchAgents/surfboard.plist
3+
which=$1
4+
5+
sudo launchctl list | fgrep $which
6+
sudo launchctl stop local.$which
7+
sudo launchctl remove local.$which
8+
sudo launchctl list | fgrep $which
9+
sudo rm -f /Library/LaunchAgents/$which.plist
810

0 commit comments

Comments
 (0)