summaryrefslogtreecommitdiff
path: root/weather-logger
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2020-09-27 20:56:34 +0200
committerPatrick Simianer <p@simianer.de>2020-09-27 20:56:34 +0200
commitae15ee1cdb06b00803f4426b0e965510661c3322 (patch)
treed5f6eadaae86f588ab91b50db26624cdadaab8de /weather-logger
parent843bb50c48a8b11c572c1e64e0237d09d635e1f0 (diff)
2020-09-27
Diffstat (limited to 'weather-logger')
-rwxr-xr-xweather-logger13
1 files changed, 6 insertions, 7 deletions
diff --git a/weather-logger b/weather-logger
index a2c957b..fc1f6a8 100755
--- a/weather-logger
+++ b/weather-logger
@@ -1,20 +1,20 @@
-#! /bin/sh
+#!/bin/sh
# /etc/init.d/weather-logger
-#
+
export SUFFIX=$(date +'%Y-%m-%d-%H:%M:%S')
-export DIR=/home/pi/weather/
+export USER=pks
+export DIR=/home/$USER/weather/
-# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting weather-logger"
rm -f $DIR/stop
- runuser -l pi -c "source $DIR/env/bin/activate && python $DIR/receive.py 2>$DIR/weather.$SUFFIX.err > $DIR/weather.$SUFFIX.out"
+ runuser -l $USER -c "source $DIR/env/bin/activate && python $DIR/receive.py 2>$DIR/weather.$SUFFIX.err > $DIR/weather.$SUFFIX.out" &
;;
stop)
echo "Stopping weather-logger"
- runuser -l pi -c "touch $DIR/stop"
+ runuser -l $USER -c "touch $DIR/stop"
;;
*)
echo "Usage: /etc/init.d/weather-logger {start|stop}"
@@ -23,4 +23,3 @@ case "$1" in
esac
exit 0
-