Skip to content

Commit 8c6ee43

Browse files
author
drbarrett
committed
Check to make sure click is running.
1 parent a07679a commit 8c6ee43

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

bin/xlog

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
#
33
# Copyright 2013 Carnegie Mellon University
44
#
@@ -16,12 +16,20 @@
1616

1717
PORT=7777
1818

19+
check() {
20+
# see if click is running
21+
pid=`ps aux | grep -v grep | grep userlevel/click | tr -s " " | cut -d\ -f2`
22+
[ "$pid" == "" ] && printf "Click is not running, aborting...\n" && exit 1
23+
}
24+
1925
get() {
26+
check
2027
printf "$1: "
2128
printf "read log.$1\nquit\n" | nc localhost $PORT | sed -n '4p'
2229
}
2330

2431
put() {
32+
check
2533
printf "write log.$1 $2\nquit\n" | nc localhost $PORT > /dev/null
2634
}
2735

0 commit comments

Comments
 (0)