blob: 84be622070fa62ad4e6bdbc270b58973566c23f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/bin/sh
### BEGIN INIT INFO
# Provides: weather-logger
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: weather-logger
### END INIT INFO
export SUFFIX=$(date +'%Y-%m-%d-%H:%M:%S')
export USER=pks
export DIR=/home/$USER/weather_logger/
export PYTHONPATH=/home/$USER/.local/lib/python3.7/site-packages/
case "$1" in
start)
echo "Starting weather-logger"
rm -f $DIR/stop
#runuser -l $USER -c "source $DIR/env/bin/activate && python $DIR/receive.py 2>$DIR/weather.$SUFFIX.err > $DIR/weather.$SUFFIX.out" &
runuser -l $USER -c "python3.7 $DIR/receive.py 2>$DIR/log/weather.$SUFFIX.err > $DIR/log/weather.$SUFFIX.out" &
;;
stop)
echo "Stopping weather-logger"
runuser -l $USER -c "touch $DIR/stop"
;;
*)
echo "Usage: /etc/init.d/weather-logger {start|stop}"
exit 1
;;
esac
exit 0
|