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

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

parents 7364878d f94102ce
#!/bin/sh #!/bin/sh
# Install/uninstall, start/stop/restart, testrun frewe-client
if [ -x /usr/bin/dirname ] && [ -x /usr/bin/readlink ] ### BEGIN INIT INFO
then # Provides: frewe-client
# Required-Start:
if [ -L $0 ] # Required-Stop:
then # Default-Start: 2 3 4 5
DIR=$(dirname $(readlink -f $0)) ; # Default-Stop:
else # Short-Description: Frewe upload client
DIR=$(dirname $0) ;
fi
else
DIR="/var/spool/frewe"
fi
if [ "$DIR" == "." ]
then
DIR="`pwd`"
fi
DIR="/var/spool/frewe"
PRONAME="frewe-client" PRONAME="frewe-client"
BINFILE="/usr/local/bin/$PRONAME" BINFILE="/usr/local/bin/$PRONAME"
CFGFILE="/etc/$PRONAME.cfg" CFGFILE="/etc/$PRONAME.cfg"
LOGFILE="/dev/null" LOGFILE="/dev/null"
# Uncomment to enable local data logging # Uncomment to enable local data logging
#LOGFILE="$DIR/$PRONAME.csv" #LOGFILE="/tmp/$PRONAME.csv"
if [ ! -f "$BINFILE" ] if [ ! -f "$BINFILE" ]
then then
...@@ -48,43 +38,6 @@ $BINFILE -H ...@@ -48,43 +38,6 @@ $BINFILE -H
case "$1" in 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) start)
if [ "`pidof $PRONAME`" != "" ] if [ "`pidof $PRONAME`" != "" ]
...@@ -131,16 +84,6 @@ echo "$PRONAME started with PID `pidof $PRONAME`" ...@@ -131,16 +84,6 @@ echo "$PRONAME started with PID `pidof $PRONAME`"
stat) 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`" != "" ] if [ "`pidof $PRONAME`" != "" ]
then then
echo "$PRONAME is running with PID `pidof $PRONAME`" echo "$PRONAME is running with PID `pidof $PRONAME`"
...@@ -151,22 +94,9 @@ fi ...@@ -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 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