[weewx-user] Re: RAM disc for web server data
I wrote: Killing three birds with one stone ... I have an init script (attached) that: OFFFS ... first post and I screw up by failing to attach the script R -- R A Lichtensteiger “Don’t make something unless it is both necessary and useful; but if it is both necessary and useful, don’t hesitate to make it beautiful.” —Shaker philosophy -- 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/20190729164129.GC10844%40mta.tifosi.com. #!/bin/sh # Startup script to sync to/from a ramdisk for WeeWX for Debian derivatives # ### BEGIN INIT INFO # Provides: weewx-ramdisk # Required-Start:$local_fs $remote_fs $syslog $time # Required-Stop: $local_fs $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: weewx weather system ramdisk # Description: Manages a ramdisk for the web output of weewx ### END INIT INFO # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="weewx weather system ramdisk" NAME=weewx-ramdisk TARGET="/var/www/weather" BACKUP="/var/backups/weewx-webdir" LOGFILE="/var/log/weewx/webdir-sync.log" RSYNC_BIN="/usr/bin/rsync" # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # Exit if the rsync package is not installed [ -x "$RSYNC_BIN" ] || exit 0 # Load the VERBOSE setting and other rcS variables . /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 if [ "$START_WEEWX" = no ] then log_action_msg "Not starting $DESC, see /etc/default/$NAME" exit 0 fi case "$1" in start) echo "Copying files to ramdisk" $RSYNC_BIN -av ${BACKUP}/ ${TARGET}/ echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk restored from HD >> ${LOGFILE} ;; stop|sync|reload) echo "Synching files from ramdisk to Harddisk" echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk backed up to HD >> ${LOGFILE} $RSYNC_BIN -av --delete --recursive --force ${TARGET}/ ${BACKUP}/ ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|sync|reload}" exit 1 ;; esac exit 0
[weewx-user] Re: RAM disc for web server data
("Long time listener, first time caller") vince wrote: On Wednesday, July 24, 2019 at 6:55:42 AM UTC-7, James Muirhead wrote As the web server data is written to the SD every 5 minutes, I felt it would be appropriate to create a RAM disc for it. Should, in theory, improve lifespan of the SD card. [...] One thing you might think about is stashing your NOAA files to disk periodically (couple times a day) and restoring them, as they take a long time to regenerate as you get more and more data. The other stuff will regenerate quickly on firstboot of course. Like many, I stumbled onto the tmpfs ram drive solution a while ago. Killing three birds with one stone ... I have an init script (attached) that: o Backs up the web directory on shutdown or when called with "sync" or "reload" o Restores the web directory on startup Cron entry runs the "sync" nightly, the other two modes are self explanatory. R People using systemd are on their own -- R A Lichtensteiger Power corrupts. Absolute power corrupts absolutely. But it rocks absolutely, too. -- 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/20190729163747.GA10844%40mta.tifosi.com.