If you're wanting a ramdisk because SD cards are unreliable, I wouldn't bother. There is plenty of history of people running Weewx on Raspberry Pis for many years without a problem with corrupted SD cards.
On Sat, Mar 12, 2022 at 12:55 PM vince <vinceska...@gmail.com> wrote: > I would try 'mkdir /home/weewx/public_html/forecast' so the parent > directory exists when weewx tries to write it. > > I'd also add that doing it your way means your NOAA files will be > recreated every time it boots, which could take ages if you have many years > of info like many of us do. > > One way would be to put something in your rc.local which runs after things > mount ala: > > if [ -d /home/weewx/public_html ] > then > # prepopulate things here > mkdir /home/weewx/public_html/forecast > else > logger "error - rc.local could not mkdir for weewx" > fi > > You might run into timing issues if you do too much this way since > rc.local tends to run toward the end of the startup sequence, but a quick > mkdir should work. > > On Saturday, March 12, 2022 at 12:40:49 PM UTC-8 Eric K wrote: > >> Currently running weewx 4.5.1 in a Raspberry Pi 3B+ with the Bullseye >> version of Raspberry Pi OS. >> For a Raspberry Pi (using a microSD card as the OS system drive) I want >> to create a ramdisk for the /home/weewx/public_html directory. >> I followed examples from various webpages on the ramdisk topic. >> What I've tried thus far doesn't fully work. >> How are others implementing this? >> >> I started by renaming my /home/weewx/public_html directory to >> /home/weewx/public_html_backup, so there would be no conflict when the >> ramdisk was created at bootup. >> Then, I put this line in the /etc/fstab file and rebooted. >> tmpfs /home/weewx/public_html tmpfs defaults,noatime,size=100M 0 0 >> I tested it with sudo mount -a and the new partition was visible by using >> the df command. >> >> After a reboot, a /home/weewx/public_html directory was created as a >> tmpfs volume. >> To test the functionality, I manually ran wee_reports to force the >> webpage to be created. >> When wee_reports ran, the process crashed with errors, because some of >> the files don't exist from previous runs of wee_reports. >> >> pi@rpi3b:/home/weewx $ sudo bin/wee_reports >> Using configuration file /home/weewx/weewx.conf >> Generating for all time >> Traceback (most recent call last): >> File "/home/weewx/bin/user/belchertown.py", line 1390, in >> get_extension_list >> with open(forecast_file, "wb+") as file: >> FileNotFoundError: [Errno 2] No such file or directory: >> '/home/weewx/public_html/json/forecast.json' >> >> During handling of the above exception, another exception occurred: >> >> Traceback (most recent call last): >> File "/home/weewx/bin/weewx/reportengine.py", line 196, in run >> obj.start() >> File "/home/weewx/bin/weewx/reportengine.py", line 281, in start >> self.run() >> File "/home/weewx/bin/weewx/cheetahgenerator.py", line 152, in run >> ngen = self.generate(gen_dict[section_name], self.gen_ts) >> File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate >> ngen += self.generate(section[subsection], gen_ts) >> File "/home/weewx/bin/weewx/cheetahgenerator.py", line 222, in generate >> ngen += self.generate(section[subsection], gen_ts) >> File "/home/weewx/bin/weewx/cheetahgenerator.py", line 310, in generate >> searchList = self._getSearchList(encoding, timespan, >> File "/home/weewx/bin/weewx/cheetahgenerator.py", line 387, in >> _getSearchList >> searchList += obj.get_extension_list(timespan, db_lookup) >> File "/home/weewx/bin/user/belchertown.py", line 1399, in >> get_extension_list >> raise Warning( >> Warning: Error writing forecast info to >> /home/weewx/public_html/json/forecast.json. Reason: [Errno 2] No such file >> or directory: '/home/weewx/public_html/json/forecast.json' >> >> I found that if I copy the contents of my /home/weewx/public_html_backup >> folder into the /home/weewx/public_html ramdisk, then wee_reports completes >> and creates the fully populated /home/weewx/public_html directory. >> >> Is everyone else populating the ramdisk with a backup of the puclic_html >> folder at bootup time? >> >> Thanks, >> Eric >> > -- > 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/71a87cdb-be9b-4cfc-b67b-e72802faceean%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-user/71a87cdb-be9b-4cfc-b67b-e72802faceean%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Peter Quinn (415)794-2264 -- 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/CAA1SM20Dg-XiuAkYd8qNZ2z-sDOWsoCozNk9JijWOXUeui6fNQ%40mail.gmail.com.