summaryrefslogtreecommitdiff
path: root/misc/upclient/files/upclient.sh
diff options
context:
space:
mode:
Diffstat (limited to 'misc/upclient/files/upclient.sh')
-rw-r--r--misc/upclient/files/upclient.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/misc/upclient/files/upclient.sh b/misc/upclient/files/upclient.sh
new file mode 100644
index 000000000000..70470e68b6fa
--- /dev/null
+++ b/misc/upclient/files/upclient.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
+ echo "$0: Cannot determine the PREFIX" >&2
+ exit 1
+fi
+
+if [ -f ${PREFIX}/etc/upclient.conf ]; then
+ if grep -qs '^[ ]*AuthKey[ ]*=' ${PREFIX}/etc/upclient.conf; then
+ if grep -qs '^[ ]*AuthKey[ ]*=[ ]*<your_authkey>' ${PREFIX}/etc/upclient.conf; then
+ echo "upclient: AuthKey not configured in ${PREFIX}/etc/upclient.conf -- aborted." >&2
+ exit 1
+ fi
+ else
+ echo "upclient: ${PREFIX}/etc/upclient.conf is out of date -- aborted." >&2
+ exit 1
+ fi
+else
+ echo "upclient: ${PREFIX}/etc/upclient.conf doesn't exist -- aborted." >&2
+ exit 1
+fi
+
+case "$1" in
+start)
+ [ -x ${PREFIX}/sbin/upclient ] && ${PREFIX}/sbin/upclient > /dev/null && echo -n ' upclient'
+ ;;
+stop)
+ [ -r /var/run/upclient.pid ] && kill `cat /var/run/upclient.pid` > /dev/null && echo -n ' upclient'
+ ;;
+*)
+ echo "Usage: `basename $0` {start|stop}" >&2
+ ;;
+esac
+
+exit 0