bugfix and added init script
This commit is contained in:
72
lactor.init
Executable file
72
lactor.init
Executable file
@@ -0,0 +1,72 @@
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
pushd /opt/lactor
|
||||
/opt/lactor/startlactor.sh &
|
||||
popd
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
pkill -f /opt/lactor/startlactor.sh
|
||||
sleep 5s
|
||||
pkill -KILL -f /opt/lactor/startlactor.sh
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
restart|force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented then remove the
|
||||
# 'force-reload' alias
|
||||
#
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Failed to stop
|
||||
log_end_msg 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
@@ -220,7 +220,7 @@ class CanListener (can.Listener):
|
||||
self.log ("Letzte Melkung war vor %s s" % _lmdelta, 5)
|
||||
if _lmdelta < 7200:
|
||||
self.log ("2te Melkung", 1)
|
||||
self.log ("Addiere Mlichmenge Ald %d Neu %d, Zeit Alt %dNeu %d" % ( self.dataset [_address] ['ammount'], int (_mdammount), self.dataset [_address] ['time'],int (_mdtime)), 5)
|
||||
self.log ("Addiere Mlichmenge Neu %d Alt %d, Zeit Neu %dAlt %d" % ( self.dataset [_address] ['ammount'], int (_mdammount), self.dataset [_address] ['time'],int (_mdtime)), 5)
|
||||
self.dataset [_address] ['ts'] = _mdts
|
||||
self.dataset [_address] ['ammount'] = self.dataset [_address] ['ammount'] + int (_mdammount)
|
||||
self.dataset [_address] ['time'] = self.dataset [_address] ['time'] + int (_mdtime)
|
||||
@@ -350,7 +350,7 @@ if __name__ == "__main__":
|
||||
if rfidonline:
|
||||
data = readbuffer.split (' ')
|
||||
if len (data) == 3:
|
||||
newrfid = data [2]
|
||||
newrfid = int (data [2]) % 100000000
|
||||
if newrfid != rfidnr:
|
||||
print ("Neue RFID %s" % newrfid)
|
||||
rfidnr = newrfid
|
||||
|
||||
Reference in New Issue
Block a user