Migrate monitoring scripts from Python 2 to Python 3.
Replace the dhtreader.so extension with adafruit-circuitpython-dht and run the daemon with python3. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,9 +10,10 @@
|
||||
# Description: Temperature and Humidity Monitoring daemon
|
||||
### END INIT INFO
|
||||
|
||||
# Change the next 3 lines to suit where you install your script and what you want to call it
|
||||
# Change the next lines to suit where you install your script and what you want to call it
|
||||
DIR=/usr/local/bin/thMonitor
|
||||
DAEMON=$DIR/temp-humid-python-loop.py
|
||||
PYTHON=/usr/bin/python3
|
||||
SCRIPT=$DIR/temp-humid-read-loop.py
|
||||
DAEMON_NAME=thMonitor
|
||||
|
||||
# Add any command line options for your daemon here
|
||||
@@ -29,7 +30,7 @@ PIDFILE=/var/run/$DAEMON_NAME.pid
|
||||
|
||||
do_start () {
|
||||
log_daemon_msg "Starting system $DAEMON_NAME daemon"
|
||||
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS
|
||||
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --startas $PYTHON -- $SCRIPT $DAEMON_OPTS
|
||||
log_end_msg $?
|
||||
}
|
||||
do_stop () {
|
||||
@@ -50,7 +51,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
|
||||
status_of_proc "$DAEMON_NAME" "$PYTHON" && exit 0 || exit $?
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user