Totally agree with your comments.

I’m trying to handle network and remote server issues for a station I don’t 
have remote access to, and sometimes (depending on time of year) have to wait a 
few days before I can go onsite.  So I am trying to handle conditions external 
to WeeWX.

One issue is Raspberry Pi OS “wlan0 carrier lost problem” (see 
https://www.raspberrypi.org/forums/viewtopic.php?t=233847 for a conversation).

Even if I fix each problem as they arise, I’d like to have a “belts & 
suspenders” backup solution.

Regards,

Garry Lockyer
C: +1.250.689.0686
E: [email protected]


> On Mar 28, 2021, at 11:18, Tom Keffer <[email protected]> wrote:
> 
> 
> I don't know anything about PM2, but it would be useful to know where you're 
> trying to get. Weewx is extremely stable and can literally run for years 
> without rebooting. If it is crashing, it would be better to fix that problem, 
> rather than use a process manager.
> 
>> On Sun, Mar 28, 2021 at 11:11 AM [email protected] 
>> <[email protected]> wrote:
>> PM2 (https://pm2.keymetrics.io/) is a process manager often associated with 
>> node.js apps written in Java Script. It can also manage processes written in 
>> Python (see: https://pm2.io/blog/2018/09/19/Manage-Python-Processes).
>> 
>> I was not able to get PM2 working with WeeWX - has anyone got it going?
>> 
>> I was able to get the example 'hello.py' script working.
>> 
>> When I tried 'sudo pm2 start /home/weewx/bin/weewxd' I got the following 
>> error (viewed using 'sudo pm2 logs'):
>> 
>> 1|weewxd  | /home/weewx/bin/weewxd:2
>> 1|weewxd  | #
>> 1|weewxd  | ^
>> 1|weewxd  | SyntaxError: Invalid or unexpected token
>> 1|weewxd  |     at Module._compile (internal/modules/cjs/loader.js:723:23)
>> 1|weewxd  |     at Object.Module._extensions..js 
>> (internal/modules/cjs/loader.js:789:10)
>> 1|weewxd  |     at Module.load (internal/modules/cjs/loader.js:653:32)
>> 1|weewxd  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
>> 1|weewxd  |     at Function.Module._load 
>> (internal/modules/cjs/loader.js:585:3)
>> 1|weewxd  |     at Object.<anonymous> 
>> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
>> 1|weewxd  |     at Module._compile (internal/modules/cjs/loader.js:778:30)
>> 1|weewxd  |     at Object.Module._extensions..js 
>> (internal/modules/cjs/loader.js:789:10)
>> 1|weewxd  |     at Module.load (internal/modules/cjs/loader.js:653:32)
>> 1|weewxd  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
>> PM2       | App [weewxd:1] exited with code [1] via signal [SIGINT]
>> PM2       | Script /home/weewx/bin/weewxd had too many unstable restarts 
>> (16). Stopped. "errored"
>> 
>> I suspected that was because PM2 uses the file extension to determine the 
>> script language so I changed the name of 'weewxd' to 'weewxd.py'.  Things 
>> progressed a little further but I got:
>> 
>> /root/.pm2/logs/weewxd-out.log last 15 lines:
>> /root/.pm2/logs/weewxd-error.log last 15 lines:
>> 0|weewxd   |   File "/home/weewx/bin/weewxd.py", line 20, in <module>
>> 0|weewxd   |     import configobj
>> 0|weewxd   | ImportError: No module named configobj
>> 0|weewxd   | Traceback (most recent call last):
>> 0|weewxd   |   File "/home/weewx/bin/weewxd.py", line 20, in <module>
>> 0|weewxd   |     import configobj
>> 0|weewxd   | ImportError: No module named configobj
>> 0|weewxd   | Traceback (most recent call last):
>> 0|weewxd   |   File "/home/weewx/bin/weewxd.py", line 20, in <module>
>> 0|weewxd   |     import configobj
>> 0|weewxd   | ImportError: No module named configobj
>> 0|weewxd   | Traceback (most recent call last):
>> 0|weewxd   |   File "/home/weewx/bin/weewxd.py", line 20, in <module>
>> 0|weewxd   |     import configobj
>> 0|weewxd   | ImportError: No module named configobj
>> 
>> I assume that WeeWx is starting up but the Python interpreter can't find the 
>> file for the the import, so perhaps something needs to be tweaked in PATH?  
>> I don't want to change anything in that area with advice.
>> 
>> Starting/stopping WeeWX with '/etc/init.d/weewx' works perfectly.
>> 
>> Regards and thanks in advance,
>> 
>> Garry
>> 
>> 
>> -- 
>> 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/830dc248-93ad-489e-b4d8-d2169332a318n%40googlegroups.com.
> 
> -- 
> 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/CAPq0zEB_xgjs5FmmQMiUTVqCi0dpQovyQYhoL4ENguwn0zXRxA%40mail.gmail.com.

-- 
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/885A93D4-E835-4AF8-B655-731B9E438D1E%40gmail.com.

Reply via email to