Commit 65f69da7 authored by Gebhardt, Albrecht's avatar Gebhardt, Albrecht

Merge branch 'master' of gitlab.aau.at:agebhard/frewe-rpi

parents 7364878d f94102ce
#!/bin/sh
# Install/uninstall, start/stop/restart, testrun frewe-client
if [ -x /usr/bin/dirname ] && [ -x /usr/bin/readlink ]
then
if [ -L $0 ]
then
DIR=$(dirname $(readlink -f $0)) ;
else
DIR=$(dirname $0) ;
fi
else
DIR="/var/spool/frewe"
fi
if [ "$DIR" == "." ]
then
DIR="`pwd`"
fi
### BEGIN INIT INFO
# Provides: frewe-client
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Frewe upload client
DIR="/var/spool/frewe"
PRONAME="frewe-client"
BINFILE="/usr/local/bin/$PRONAME"
CFGFILE="/etc/$PRONAME.cfg"
LOGFILE="/dev/null"
# Uncomment to enable local data logging
#LOGFILE="$DIR/$PRONAME.csv"
#LOGFILE="/tmp/$PRONAME.csv"
if [ ! -f "$BINFILE" ]
then
......@@ -48,43 +38,6 @@ $BINFILE -H
case "$1" in
install)
if [ -e /var/flash/debug.cfg ] && [ "`cat /var/flash/debug.cfg | grep $PRONAME`" != "" ]
then
echo "$PRONAME is already installed. Here is the content of debug.cfg:"
cat /var/flash/debug.cfg
echo "Nothing to install"
exit 1
fi
echo "(max=12; i=0; while [ \$i -lt \$max ]; do if [ -x "$BINFILE" ]; then $BINFILE -c $CFGFILE >> $LOGFILE & break; fi; let i=\$i+1; echo Waiting for $PRONAME... \$i; sleep 5; done) &" > /var/tmp/debug.cfg
if [ -e /var/flash/debug.cfg ]
then
cat /var/flash/debug.cfg >> /var/tmp/debug.cfg
fi
cat /var/tmp/debug.cfg > /var/flash/debug.cfg
echo "$PRONAME installed. Here is the content of the new debug.cfg:"
cat /var/flash/debug.cfg
;;
uninstall)
if [ -e /var/flash/debug.cfg ]
then
cat /var/flash/debug.cfg | grep -v $PRONAME > /var/tmp/debug.cfg
cat /var/tmp/debug.cfg > /var/flash/debug.cfg
echo "$PRONAME uninstalled. Here is the content of the new debug.cfg:"
cat /var/flash/debug.cfg
else
echo "debug.cfg not found, nothing was installed..."
fi
;;
start)
if [ "`pidof $PRONAME`" != "" ]
......@@ -131,16 +84,6 @@ echo "$PRONAME started with PID `pidof $PRONAME`"
stat)
if [ "`cat /var/flash/debug.cfg | grep $PRONAME`" != "" ]
then
echo "$PRONAME is installed. Here is content of debug.cfg:"
cat /var/flash/debug.cfg
else
echo "$PRONAME is not installed"
fi
echo
if [ "`pidof $PRONAME`" != "" ]
then
echo "$PRONAME is running with PID `pidof $PRONAME`"
......@@ -151,22 +94,9 @@ fi
;;
testrun)
$BINFILE -v
;;
testruncfg)
$BINFILE -v -c $CFGFILE -r 0
;;
*)
echo "Usage: $0 {install|uninstall|start|stop|restart|stat|testrun|testruncfg}"
echo "Usage: $0 {start|stop|restart|stat}"
exit 1
;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment