Author Topic: RPi Autostart - does this look correct?  (Read 1874 times)

0 Members and 1 Guest are viewing this topic.

Offline kbellis

  • Forecaster
  • *****
  • Posts: 361
RPi Autostart - does this look correct?
« on: January 24, 2019, 03:40:42 PM »
 [ You are not allowed to view attachments ]

Is this the correct method to ensure that weewx automatically starts every time I reboot my RPi?

Thank you for any reply.

Kind regards,

Kelly
« Last Edit: January 24, 2019, 04:25:47 PM by kbellis »

Offline vreihen

  • El Niņo chaser
  • Forecaster
  • *****
  • Posts: 1216
  • K2BIG
Re: RPi Autostart - does this look correct?
« Reply #1 on: January 24, 2019, 08:03:35 PM »
Typing this one line at a command prompt should do all of the magic, no file editing necessary:

sudo systemctl enable weewx.service

Most of the Pi instructions out there for starting programs on boot are for hacks from before Raspbian supported the systemctl function.....
WU Gold Stars for everyone! :lol:

Offline Aussie Susan

  • Senior Member
  • **
  • Posts: 75
Re: RPi Autostart - does this look correct?
« Reply #2 on: January 24, 2019, 09:11:00 PM »
if you want to get really adventurous, you may want to check what is in the weewx.service file (type "systemctl status weewx" - perhaps with "sudo" in front - to see where the file is located) to make sure that weewx starts after all of the required othe rservices are up.
For example, you may want to make sure the NTP is running so the time is set correctly, or if you use the network in some way to check that is running and so on.
Susan

Offline kbellis

  • Forecaster
  • *****
  • Posts: 361
Re: RPi Autostart - does this look correct?
« Reply #3 on: January 25, 2019, 09:10:11 AM »
Thank you, Arthur and Susan, for your replies.

Can't wait to get that a try!

Not exactly sure if this should be expected:
 [ You are not allowed to view attachments ]

And then this:
Code: [Select]
pi@raspberrypi:~ $ sudo systemctl enable weewx.service
weewx.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable weewx
pi@raspberrypi:~ $ sudo systemctl status weewx
● weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
   Active: active (running) since Thu 2019-01-24 14:18:05 EST; 18h ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/weewx.service
           └─466 python /usr/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /e

Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:0
Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:0
Jan 25 08:55:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for
Jan 25 08:55:18 raspberrypi weewx[466]: imagegenerator: Generated 12 images for
Jan 25 08:55:18 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/ww
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:0
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:0
Jan 25 09:00:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for
Jan 25 09:00:21 raspberrypi weewx[466]: imagegenerator: Generated 36 images for
Jan 25 09:00:21 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/ww
lines 1-17/17 (END)
























● weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
   Active: active (running) since Thu 2019-01-24 14:18:05 EST; 18h ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/weewx.service
           └─466 python /usr/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weew

Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:00 EST (154842
Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:00 EST (154842
Jan 25 08:55:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for report Stand
Jan 25 08:55:18 raspberrypi weewx[466]: imagegenerator: Generated 12 images for StandardRepor
Jan 25 08:55:18 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/www/html/weewx
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:00 EST (154842
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:00 EST (154842
Jan 25 09:00:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for report Stand
Jan 25 09:00:21 raspberrypi weewx[466]: imagegenerator: Generated 36 images for StandardRepor
Jan 25 09:00:21 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/www/html/weewx
~
~
~
~
~
~
lines 1-17/17 (END)
























● weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
   Active: active (running) since Thu 2019-01-24 14:18:05 EST; 18h ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/weewx.service
           └─466 python /usr/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf

Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:00 EST (1548424500) to database 'weewx.sdb'
Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:00 EST (1548424500) to daily summary in 'wee
Jan 25 08:55:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for report StandardReport in 1.25 seconds
Jan 25 08:55:18 raspberrypi weewx[466]: imagegenerator: Generated 12 images for StandardReport in 0.82 seconds
Jan 25 08:55:18 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/www/html/weewx
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:00 EST (1548424800) to database 'weewx.sdb'
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:00 EST (1548424800) to daily summary in 'wee
Jan 25 09:00:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for report StandardReport in 1.35 seconds
Jan 25 09:00:21 raspberrypi weewx[466]: imagegenerator: Generated 36 images for StandardReport in 3.43 seconds
Jan 25 09:00:21 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/www/html/weewx
~
~
~
~
~
~
lines 1-17/17 (END)
























● weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
   Active: active (running) since Thu 2019-01-24 14:18:05 EST; 18h ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/weewx.service
           └─466 python /usr/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf

Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:00 EST (1548424500) to database 'weewx.sdb'
Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:00 EST (1548424500) to daily summary in 'weewx.sdb'
Jan 25 08:55:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for report StandardReport in 1.25 seconds
Jan 25 08:55:18 raspberrypi weewx[466]: imagegenerator: Generated 12 images for StandardReport in 0.82 seconds
Jan 25 08:55:18 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/www/html/weewx
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:00 EST (1548424800) to database 'weewx.sdb'
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:00 EST (1548424800) to daily summary in 'weewx.sdb'
Jan 25 09:00:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for report StandardReport in 1.35 seconds
Jan 25 09:00:21 raspberrypi weewx[466]: imagegenerator: Generated 36 images for StandardReport in 3.43 seconds
Jan 25 09:00:21 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/www/html/weewx
~
~
~
~
~
~
lines 1-17/17 (END)...skipping...
● weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
   Active: active (running) since Thu 2019-01-24 14:18:05 EST; 18h ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/weewx.service
           └─466 python /usr/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf

Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:00 EST (1548424500) to database 'weewx.sdb'
Jan 25 08:55:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 08:55:00 EST (1548424500) to daily summary in 'weewx.sdb'
Jan 25 08:55:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for report StandardReport in 1.25 seconds
Jan 25 08:55:18 raspberrypi weewx[466]: imagegenerator: Generated 12 images for StandardReport in 0.82 seconds
Jan 25 08:55:18 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/www/html/weewx
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:00 EST (1548424800) to database 'weewx.sdb'
Jan 25 09:00:16 raspberrypi weewx[466]: manager: Added record 2019-01-25 09:00:00 EST (1548424800) to daily summary in 'weewx.sdb'
Jan 25 09:00:17 raspberrypi weewx[466]: cheetahgenerator: Generated 14 files for report StandardReport in 1.35 seconds
Jan 25 09:00:21 raspberrypi weewx[466]: imagegenerator: Generated 36 images for StandardReport in 3.43 seconds
Jan 25 09:00:21 raspberrypi weewx[466]: copygenerator: copied 0 files to /var/www/html/weewx
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
lines 1-17/17 (END)

Offline kbellis

  • Forecaster
  • *****
  • Posts: 361
Re: RPi Autostart - does this look correct?
« Reply #4 on: January 25, 2019, 10:24:41 AM »
That worked great! Thanks again!!

Offline kbellis

  • Forecaster
  • *****
  • Posts: 361
Re: RPi Autostart - does this look correct?
« Reply #5 on: January 26, 2019, 10:03:42 AM »
Can't tell if NTP is running from what you've suggested; however, I think it's not running after this:
Code: [Select]
ps aux | grep NTP
 [ You are not allowed to view attachments ]

How to get NTP automatically to run at local midnight?, for example.

How to remove or rather disable weewx.service from systemctl?


if you want to get really adventurous, you may want to check what is in the weewx.service file (type "systemctl status weewx" - perhaps with "sudo" in front - to see where the file is located) to make sure that weewx starts after all of the required othe rservices are up.
For example, you may want to make sure the NTP is running so the time is set correctly, or if you use the network in some way to check that is running and so on.
Susan
« Last Edit: January 26, 2019, 10:12:54 AM by kbellis »

Offline vinceskahan

  • Senior Contributor
  • ****
  • Posts: 180
    • home site
Re: RPi Autostart - does this look correct?
« Reply #6 on: February 05, 2019, 09:51:57 PM »
You're running into a variety of things - all of them systemd related.

  • to enable/disable services, you run the 'systemctl' command as root
  • systemd runs its own ntp-like time synch service if you don't install the (optional) ntpd package.  If you 'do' install it, then it uses the external ntp service and does not use its built-in service

Suggest you take 5 minutes with your pal Google to look up your questions, they're definitely frequently asked questions.
WeeWX sites:
  Davis VP2+DFARS to a pi4
  EcoWitt GW1000, WH32 outdoor T+H, multiple WH31 indoor T+H, WH51 soilMoisture (docker)
  Davis AirLink (inside)
  PurpleAir (outside)
Home site:        https://www.skahan.net/
Wunderground: KWAFEDER15
PWS:                KWFEDER15
CWOP:              CW6881

Offline kbellis

  • Forecaster
  • *****
  • Posts: 361
Re: RPi Autostart - does this look correct?
« Reply #7 on: February 07, 2019, 06:41:51 AM »
Thanks for the reply Vince. Google it is, then!



You're running into a variety of things - all of them systemd related.

  • to enable/disable services, you run the 'systemctl' command as root
  • systemd runs its own ntp-like time synch service if you don't install the (optional) ntpd package.  If you 'do' install it, then it uses the external ntp service and does not use its built-in service

Suggest you take 5 minutes with your pal Google to look up your questions, they're definitely frequently asked questions.

Offline kbellis

  • Forecaster
  • *****
  • Posts: 361
Re: RPi Autostart - does this look correct?
« Reply #8 on: February 08, 2019, 10:16:25 AM »
I think the I've eliminated the automatic startup of weewx each time the RPi boots:
 [ You are not allowed to view attachments ]

After having first disabled the service prior to the reboot:
 [ You are not allowed to view attachments ]

Please correct me if I've misunderstood these terse messages from the terminal display.

Thank you.

Kelly

Offline kbellis

  • Forecaster
  • *****
  • Posts: 361
Re: RPi Autostart - does this look correct?
« Reply #9 on: February 08, 2019, 10:36:16 AM »
This is probably where I should have looked to begin with if only had I known better;
Reference: How to configure weewx to run in a systemd environment
https://github.com/weewx/weewx/wiki/systemd

Offline pfletch101

  • Forecaster
  • *****
  • Posts: 329
    • Personal Website
Re: RPi Autostart - does this look correct?
« Reply #10 on: March 05, 2019, 05:47:26 PM »
FWIW, the "weewx.service is not a native service...." messages are benign and 'for information only', and will always be seen if you have weewx configured to run in 'the old-fashioned way' from a rc script. If you follow the recipe that you found in the weewx wiki to run weewx directly as a system service, you won't see them.
Vantage Pro 2+ connected to Raspberry Pi running weewx by means of Meteo-Pi - data incorporated in domestic energy production (PV) and use monitoring system.

Offline kbellis

  • Forecaster
  • *****
  • Posts: 361
Re: RPi Autostart - does this look correct?
« Reply #11 on: March 06, 2019, 07:21:59 AM »
Thanks for the reply pfletch!