Since I detest systemd and friends, I wrote a perl script to run as a cron job to start weewx as needed. Suites me just fine. Since weewx is so stable, it rarely has to be restarted. I use the same basic script for several other things, and quite happy with it. Oh, and the cron job is OS-agnostic, which is a plus for me.
Chris On Sunday, March 3, 2024 at 2:34:23 PM UTC-7 Invisible Man wrote: > To my understanding, the commands are the same in terms of "what they do", > i.e start weewx. > The difference lies in how easy it is to manage weewx. > > 1. If you use weewx as a service, you can easily start/stop/restart/mask > (etc) your service with the systemctl commands. This includes for example > restarting weewx if it has stopped. Also, you can ensure at boot time that > weewx only tries to start once your host has network for example. > > 2. Crontab. IMHO, a crontab is useful to start periodic tasks, like "do a > backup at 5am". If your idea is to use a crontab just to start weewx at > boot time, the /etc/rcX.d directories are probably better suited. If you > want the crontab to periodically check weewx is running and restart it if > it's down, then yes, you can do it with the crontab, but you'll have to > write the script that detects weewx is up or down and restart if necessary. > This is automatically handled by the systemctl service configuration, so > you are kind of re-inventing the wheel IMHO. > > 3. nohup weewxd. This works and it's sometimes handy because it's simple > and easy to debug. But if your weewx dies for some reason, you have no way > to restart it. Also, it's not that easy to see if you already have a weewxd > running (you'll have to do "ps aex" and grep for example) so you might > launch several instances by error. Finally, the logs go where you launched > the command, they are not centralized in journalctl like systemctl option, > or in /var/log/syslog. > > Hope it helps. There might be other differences I am missing. > > On Sunday, March 3, 2024 at 8:45:50 PM UTC+1 Remy Lavabre wrote: > >> Good morning, >> >> Small question(s) for a PIP installation: >> >> 1/ Is there a difference between: >> - the use of the weewx daemon >> - the weewxd command placed in the contrab at the RPi starting >> - the manually typed command "nohup weewxd &"? >> >> 2/What is the interest/advantage of one method compared to others? >> >> THANKS >> > -- 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/651adf9c-69fe-416e-9888-7da45ea0e895n%40googlegroups.com.
