Hello
the file weewx.txt :is the file in /etc/init.d/
the file etc-default-weewx.txt is the file in /etc/default/weewx
I ve used it on a old install well but since I install on a fresh install
, I ve problem with the path (weewx-multi doesnt find the "good path" of
weewxd
Thanks a lot
Stéphane
Le dim. 17 janv. 2021 à 23:31, gjr80 <[email protected]> a écrit :
> Hi,
>
> It would be helpful to see the WeeWX service file you are using and the
> corresponding defaults. Assuming you followed the weewx-multi
> <https://github.com/weewx/weewx/wiki/weewx-multi> instructions in the
> wiki the service file should be /etc/init.d/weewx and the defaults
> /etc/default/weewx-multi. Please post the contents of both here.
>
>>
>> FYI : ( I ve posted the same post in weewx developpement group)
>>
>
> Also, perhaps you did not read the weewx-user banner:
>
> There is a separate group, weewx-development, for developers who are
> actively working on extensions and the weewx codebase.
>
> *Please do not cross-post to both weewx-user and weewx-development!*
>
> Cross posting doesn't get you any more help any faster, in fact it just
> slows things down as we have twice as much to read.
>
> Gary
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "weewx-user" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/weewx-user/nlg3qFnlWB8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/f06ec671-467f-48ad-9ee8-f945d23a07acn%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/f06ec671-467f-48ad-9ee8-f945d23a07acn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/CAFkzkfV5oH-CkrB3jQAh-CiJ4rJ1jijN9o-pG%2Bg0C6Qxd%2BS9Ng%40mail.gmail.com.
WEEWX_INSTANCES="WMR200"
WEEWX_PYTHON=python2
WEEWX_BINDIR=/usr/share/weewx
WEEWX_BIN=/usr/bin/weewxd
WEEWX_CFG=/etc/weewx/weewx.conf
#! /bin/sh
# Copyright 2016 Matthew Wall, all rights reserved
# init script to run multiple instances of weewx
#
# each weewx instance is identified by name. that name is used to identify the
# configuration and pid files.
#
# this init script expects the following configuration:
# /etc/weewx/a.conf
# /etc/weewx/b.conf
# /var/run/weewx-a.pid
# /var/run/weewx-b.pid
#
# with the appropriate rsyslog and logrotate configurations:
# /var/log/weewx/a.log
# /var/log/weewx/b.log
#
# to configure the script, override variables in /etc/default/weewx-multi
# for example:
#
# WEEWX_INSTANCES="vantage acurite"
# WEEWX_BINDIR=/opt/weewx/bin
# WEEWX_CFGDIR=/etc/weewx
### BEGIN INIT INFO
# Provides: weewx-multi
# Required-Start: $local_fs $remote_fs $syslog $time
# Required-Stop: $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: weewx-multi
# Description: Manages multiple instances of weewx
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
WEEWX_INSTANCES="no_instances_specified"
WEEWX_USER=root:root
WEEWX_BINDIR=/usr/bin/
WEEWX_CFGDIR=/etc/weewx
# Try to keep systemd from screwing everything up
export SYSTEMCTL_SKIP_REDIRECT=1
# Read configuration variable file if it is present
[ -r /etc/default/weewx-multi ] && . /etc/default/weewx-multi
DESC=weewx
DAEMON=$WEEWX_BINDIR/weewxd
# Exit if the package is not installed
if [ ! -x "$DAEMON" ]; then
echo "The $DESC daemon is not installed at $DAEMON"
exit 0
fi
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# start the daemon
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
do_start() {
INSTANCE=$1
NAME=weewx-$INSTANCE
PIDFILE=/var/run/$NAME.pid
CFGFILE=$WEEWX_CFGDIR/$INSTANCE.conf
DAEMON_ARGS="--daemon --log-label $NAME --pidfile=$PIDFILE $CFGFILE"
if [ ! -f "$CFGFILE" ]; then
echo "The instance $INSTANCE does not have a config at $CFGFILE"
return 2
fi
NPROC=$(count_procs $INSTANCE)
if [ $NPROC != 0 ]; then
return 1
fi
start-stop-daemon --start --chuid $WEEWX_USER --pidfile $PIDFILE --exec
$DAEMON -- $DAEMON_ARGS || return 2
return 0
}
# stop the daemon
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
do_stop() {
INSTANCE=$1
NAME=weewx-$INSTANCE
PIDFILE=/var/run/$NAME.pid
# bail out if the app is not running
NPROC=$(count_procs $INSTANCE)
if [ $NPROC = 0 ]; then
return 1
fi
# bail out if there is no pid file
if [ ! -f $PIDFILE ]; then
return 1
fi
start-stop-daemon --stop --pidfile $PIDFILE
# we cannot trust the return value from start-stop-daemon
RETVAL=2
c=0
while [ $c -lt 24 -a "$RETVAL" = "2" ]; do
c=`expr $c + 1`
# process may not really have completed, so check it
NPROC=$(count_procs $INSTANCE)
if [ $NPROC = 0 ]; then
RETVAL=0
else
echo -n "."
sleep 5
fi
done
if [ "$RETVAL" = "0" -o "$RETVAL" = "1" ]; then
# delete the pid file just in case
rm -f $PIDFILE
fi
return "$RETVAL"
}
# send a SIGHUP to the daemon
do_reload() {
INSTANCE=$1
NAME=weewx-$INSTANCE
PIDFILE=/var/run/$NAME.pid
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
return 0
}
do_status() {
INSTANCE=$1
NAME=weewx-$INSTANCE
NPROC=$(count_procs $INSTANCE)
echo -n "$INSTANCE is "
if [ $NPROC = 0 ]; then
echo -n "not "
fi
echo "running."
}
count_procs() {
INSTANCE=$1
NAME=weewx-$INSTANCE
NPROC=`ps ax | grep $DAEMON | grep $NAME.pid | wc -l`
echo $NPROC
}
CMD=$1
if [ "$1" != "" ]; then
shift
fi
INSTANCES="$@"
if [ "$INSTANCES" = "" ]; then
INSTANCES=$WEEWX_INSTANCES
fi
case "$CMD" in
start)
for i in $INSTANCES; do
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$i"
do_start $i
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
done
;;
stop)
for i in $INSTANCES; do
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$i"
do_stop $i
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
done
;;
status)
for i in $INSTANCES; do
do_status "$i"
done
;;
reload|force-reload)
for i in $INSTANCES; do
log_daemon_msg "Reloading $DESC" "$i"
do_reload $i
log_end_msg $?
done
;;
restart)
for i in $INSTANCES; do
log_daemon_msg "Restarting $DESC" "$i"
do_stop $i
case "$?" in
0|1)
do_start $i
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
done
;;
*)
echo "Usage: $0 {start|stop|restart|reload} [instance]" >&2
exit 3
;;
esac