It was all going so well....I did as you suggested - first copied all my 
old weewx files to a USB drive on the Pi,  bought a new SD card, installed 
the latest Raspbian OS (Bookworm) and got my shiny new SD card running 
fine.  I then installed weewx and it started weewx up as expected and began 
populating the empty database from 4 Sept on.  Then I tried to stop weewx 
so I could copy across the old database with all my history from 2016 
onwards.  For some bizarre reason I couldn't get the stop command to work, 
as per below extract:

xxxxx@weatherpi:/etc $ sudo /etc/init.d/weewx stop
sudo: /etc/init.d/weewx: command not found

Am I being dumb?  Any reason why this shouldn't work?

Thanks

David.

On Wednesday 4 September 2024 at 22:25:38 UTC+1 David Hindley wrote:

> Tom - OK. Many thanks. Will try that suggestion. 
>
> David. 
>
> On Wed, 4 Sep 2024 at 21:32, Tom Keffer <tke...@gmail.com> wrote:
>
>> I'm sorry, but there are too many moving parts here. The problem depends 
>> on your environment, /etc/default/weewx, what's in /usr/bin/weewxd, the 
>> location of the other weewx files, etc. 
>>
>> Something changed on your system. You're going to have to track it down.
>>
>> Here's what I would do: get a second SD card (less than $10). Install the 
>> latest RPi OS on it. Install WeeWX v5 on it.
>>
>> Then copy over the database (located under /var/lib/weewx) and the skins 
>> (located under /etc/weewx) from the old card. Or, copy from your backup. No 
>> chance of losing any data.
>>
>> -tk
>>
>> On Wed, Sep 4, 2024 at 1:05 PM hind...@gmail.com <hind...@gmail.com> 
>> wrote:
>>
>>> OK.  No problem.  It is attached.  I renamed it to weewx_init. It is 
>>> called weewx on my Pi.
>>>
>>> Noted re upgrading.  Nervous about losing data etc.
>>>
>>> David.
>>>
>>> On Wednesday 4 September 2024 at 20:44:54 UTC+1 Tom Keffer wrote:
>>>
>>>> A favor. Please post the *entire* file. Don't cut and paste, just 
>>>> include the file. It's hard to get the full picture from the little pieces.
>>>>
>>>> I would also strongly advise that you upgrade from stretch. It hasn't 
>>>> been supported in years. Your RPi 3 is more than capable of running a 
>>>> modern version of RPi OS.
>>>>
>>>> On Wed, Sep 4, 2024 at 12:06 PM hind...@gmail.com <hind...@gmail.com> 
>>>> wrote:
>>>>
>>>>> I should add, when I start weewx, I get: 
>>>>>
>>>>> [....] Starting weewx (via systemctl): weewx.service==== 
>>>>> AUTHENTICATING FOR org.                                                   
>>>>>   
>>>>>                                                                           
>>>>>   
>>>>>                                                                           
>>>>>   
>>>>>                                 freedesktop.systemd1.manage-units ===
>>>>> Authentication is required to start 'weewx.service'.
>>>>> Multiple identities can be used for authentication:
>>>>>  1.  ,,, (pi)
>>>>>  2.  root
>>>>> Choose identity to authenticate as (1-2): 1
>>>>> Password:
>>>>> ==== AUTHENTICATION COMPLETE ===
>>>>> Job for weewx.service failed because the control process exited with 
>>>>> error code.
>>>>> See "systemctl status weewx.service" and "journalctl -xe" for details.
>>>>>  failed!
>>>>>
>>>>> Does that helpo diagnose the problem.  I never remember being asked 
>>>>> for identity before.  I am not sure I know the root password (dumb, I 
>>>>> know).
>>>>> On Wednesday 4 September 2024 at 19:47:33 UTC+1 hind...@gmail.com 
>>>>> wrote:
>>>>>
>>>>>> No problem.
>>>>>>
>>>>>> Copied below.
>>>>>>
>>>>>> I don't think I modified anything,  My weather website stopped 
>>>>>> working when I was on holiday. The last valid graph entry is 20 August 
>>>>>> 2024 
>>>>>> at 5pm  -but not sure my syslog files go back that far to check what 
>>>>>> happened.
>>>>>>
>>>>>> . /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/service
>>>>>> #   0 if daemon has been started
>>>>>> #   1 if daemon was already running
>>>>>> #   2 if daemon could not be started
>>>>>> # check using ps not the pid file.  pid file could be leftover.
>>>>>> do_start() {
>>>>>>     NPROC=$(count_procs)
>>>>>>     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/service
>>>>>> #   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() {
>>>>>>     # bail out if the app is not running
>>>>>>     NPROC=$(count_procs)
>>>>>>     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)
>>>>>>         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/service
>>>>>> do_reload() {
>>>>>>     start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
>>>>>>     return 0
>>>>>> }
>>>>>>
>>>>>> count_procs() {
>>>>>>     NPROC=`ps ax | grep $WEEWX_BIN | grep $NAME.pid | wc -l`
>>>>>>     echo $NPROC
>>>>>> }
>>>>>>
>>>>>> RETVAL=0
>>>>>> case "$1" in
>>>>>>     start)
>>>>>>         log_daemon_msg "Starting $DESC" "$NAME"
>>>>>>         do_start
>>>>>>         case "$?" in
>>>>>>             0) log_end_msg 0; RETVAL=0 ;;
>>>>>>             1) log_action_cont_msg " already running" && log_end_msg 
>>>>>> 0; RETVAL=0 ;;
>>>>>>             2) log_end_msg 1; RETVAL=1 ;;
>>>>>>         esac
>>>>>>         ;;
>>>>>>     stop)
>>>>>>         log_daemon_msg "Stopping $DESC" "$NAME"
>>>>>>         do_stop
>>>>>>         case "$?" in
>>>>>>             0) log_end_msg 0; RETVAL=0 ;;
>>>>>>             1) log_action_cont_msg " not running" && log_end_msg 0; 
>>>>>> RETVAL=0 ;;
>>>>>>             2) log_end_msg 1; RETVAL=1 ;;
>>>>>>         esac
>>>>>>         ;;
>>>>>>    
>>>>>> On Wednesday 4 September 2024 at 18:33:29 UTC+1 Tom Keffer wrote:
>>>>>>
>>>>>> Sorry, but we're going to have to see the entire file. We need to see 
>>>>>> how weewxd is invoked.
>>>>>>
>>>>>> One more question: what did you modify? Any reason you can think of 
>>>>>> why it stopped working?
>>>>>>
>>>>>> -tk
>>>>>>
>>>>>> On Wed, Sep 4, 2024 at 10:23 AM hind...@gmail.com <hind...@gmail.com> 
>>>>>> wrote:
>>>>>>
>>>>>> Thanks, Tom.
>>>>>>
>>>>>> Weewx is version 4.10.2
>>>>>>
>>>>>> /etc/init.d/weewx contains a lot of code. The path section is:
>>>>>>
>>>>>> PATH=/sbin:/usr/sbin:/bin:/usr/bin
>>>>>>
>>>>>> WEEWX_BIN=/usr/bin/weewxd
>>>>>>
>>>>>> WEEWX_CFG=/etc/weewx/weewx.conf
>>>>>>
>>>>>> WEEWX_USER=root:root
>>>>>>
>>>>>> DESC="weewx weather system"
>>>>>>
>>>>>> NAME=weewx
>>>>>>
>>>>>> PIDFILE=/var/run/$NAME.pid
>>>>>> My RPi is Raspberry Pi 3 Model B Plus Rev 1.3.  I am running it under 
>>>>>> quite an old Raspbian version - "Stretch".
>>>>>>
>>>>>> Sorry - how do I use a systemd service file?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> David. 
>>>>>>
>>>>>>
>>>>>> On Wednesday 4 September 2024 at 17:48:36 UTC+1 Tom Keffer wrote:
>>>>>>
>>>>>> Some sort of PYTHONPATH problem I would imagine, but we need more 
>>>>>> information.
>>>>>>
>>>>>> What version of WeeWX?
>>>>>> What's in your /etc/init.d/weewx?
>>>>>> What version of RaspberryPi OS?
>>>>>> Assuming a reasonably recent version, why not use a systemd service 
>>>>>> file?
>>>>>>
>>>>>> If all else fails, set debug=1, restart weewxd, post the log.
>>>>>>
>>>>>>
>>>>>> On Wed, Sep 4, 2024 at 4:31 AM hind...@gmail.com <hind...@gmail.com> 
>>>>>> wrote:
>>>>>>
>>>>>> For some unknown reason my weather station is no longer updating - 
>>>>>> which must be due to weewx having failed somehow. When I restart my 
>>>>>> Raspberry Pi, to try to reset things, I get the following:
>>>>>>
>>>>>> weewx.service - LSB: weewx weather system
>>>>>>
>>>>>>    Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: 
>>>>>> enabled)
>>>>>>
>>>>>>    Active: failed (Result: exit-code) since Wed 2024-09-04 12:23:03 
>>>>>> BST; 2min 34s ago
>>>>>>
>>>>>>      Docs: man:systemd-sysv-generator(8)
>>>>>>
>>>>>>   Process: 480 ExecStart=/etc/init.d/weewx start (code=exited, 
>>>>>> status=1/FAILURE)
>>>>>>
>>>>>>  
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi weewx[480]:   File 
>>>>>> "/usr/share/weewx/weewxd", line 25, in <module>
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi weewx[480]:     import weeutil.logger
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi weewx[480]:   File 
>>>>>> "/usr/share/weewx/weeutil/logger.py", line 17, in <module>
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi weewx[480]:     import weewx
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi weewx[480]: ImportError: No module named 
>>>>>> weewx
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi weewx[480]:  failed!
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi systemd[1]: weewx.service: Control 
>>>>>> process exited, code=exited status=1
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi systemd[1]: Failed to start LSB: weewx 
>>>>>> weather system.
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi systemd[1]: weewx.service: Unit entered 
>>>>>> failed state.
>>>>>>
>>>>>> Sep 04 12:23:03 raspberrypi systemd[1]: weewx.service: Failed with 
>>>>>> result 'exit-code'.
>>>>>>
>>>>>> ~
>>>>>>
>>>>>>
>>>>>> Anyone know what is going on please?
>>>>>>
>>>>>> Many Thanks
>>>>>>
>>>>>>
>>>>>> David.
>>>>>>
>>>>>> -- 
>>>>>> 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 weewx-user+...@googlegroups.com.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/weewx-user/21297d91-d219-4790-85d2-d1d2131075acn%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/weewx-user/21297d91-d219-4790-85d2-d1d2131075acn%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 weewx-user+...@googlegroups.com.
>>>>>>
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/weewx-user/fba5220b-9442-437a-851d-e7035570faa5n%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/weewx-user/fba5220b-9442-437a-851d-e7035570faa5n%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 weewx-user+...@googlegroups.com.
>>>>>
>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/weewx-user/7adf621a-02c3-439c-a9b9-24bdfaea945cn%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/weewx-user/7adf621a-02c3-439c-a9b9-24bdfaea945cn%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 weewx-user+...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/weewx-user/f0565f28-737f-4e30-9541-77f513b5a13an%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/f0565f28-737f-4e30-9541-77f513b5a13an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> -- 
>>
> 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/CWN10iKhjUA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> weewx-user+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/CAPq0zEDECt6FyoqjO%2Bq_evimMomJJb4dtDJEXfBce1fgt7vpvA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/CAPq0zEDECt6FyoqjO%2Bq_evimMomJJb4dtDJEXfBce1fgt7vpvA%40mail.gmail.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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/3a77e952-f386-42ec-b57c-58ea235ba826n%40googlegroups.com.

Reply via email to