I'm still here.
I tried to start interceptWH2600.py via the interceptWH2600.sh script.
The script works but interceptWH2600.py does not start.
Code: Select all
pi@RASPBERRYPI-182:~/interceptWH2600 $ sudo /etc/init.d/interceptWH2600.sh start
[ ok ] Starting interceptWH2600.sh (via systemctl): interceptWH2600.service.
pi@RASPBERRYPI-182:~/interceptWH2600 $ /etc/init.d/interceptWH2600.sh status
● interceptWH2600.service - LSB: Intercept weather data from your WH2600 Weather Station
Loaded: loaded (/etc/init.d/interceptWH2600.sh)
Active: active (exited) since sam 2017-11-11 11:37:47 CET; 4s ago
Process: 11875 ExecStop=/etc/init.d/interceptWH2600.sh stop (code=exited, status=0/SUCCESS)
Process: 11961 ExecStart=/etc/init.d/interceptWH2600.sh start (code=exited, status=0/SUCCESS)
sudo cp /home/pi/interceptWH2600/interceptWH2600.sh /etc/init.d
sudo chmod 0755 /etc/init.d/interceptWH2600.sh
sudo systemctl daemon-reload
sudo /etc/init.d/interceptWH2600.sh start
start-stop-daemon line :
Code: Select all
start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --name $daemon_NAME --quiet --chuid $DAEMONUSER --startas $DAEMON
Code: Select all
#!/bin/sh
### BEGIN INIT INFO
# Provides: interceptWH2600
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Intercept weather data from your WH2600 Weather Station
# Description: Intercept weather data from your WH2600 Weather Station
### END INIT INFO
# Change the next 3 lines to suit where you install your script and what you want to call it
DIR=/home/pi/interceptWH2600
DAEMON=$DIR/interceptWH2600.py
DAEMON_NAME=interceptWH2600
DAEMON_OPTS=""
LOG=/home/pi/interceptWH2600/interceptWH2600.log
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
# This next line determines what user the script runs as.
# Root generally not recommended but necessary if you are using the Raspberry Pi GPIO from Python.
DAEMON_USER=pi
# The process ID of the script when it runs is stored here:
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 --name $daemon_NAME --quiet --chuid $DAEMONUSER --startas $DAEMON -- $DAEMON_OPTS
$DAEMON_OPTS
log_end_msg $?
}
do_stop () {
log_daemon_msg "Stopping system $DAEMON_NAME daemon"
start-stop-daemon --stop --pidfile $PIDFILE --retry 10
log_end_msg $?
}
case "$1" in
start|stop)
#do_${1}
;;
stop)
do_stop
#do_${1}
;;
restart|reload|force-reload)
do_stop
do_start
;;
status)
status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
exit 1
;;
esac
exit 0