I've been using this script that I found and run it through sudo crontab it 
is named weewx_backup.sh. I know it's probably overkill but I run it every 
2 hours via cron. You will need to modify the backup location to match your 
liking.

#!/bin/bash





# A script to backup weewx configuration files to NAShostname (and SQLite 
data until MySQL service can be restored)





# While SQLite is being used, the service needs to be stopped before 
copying the data file to avoid corruption if the system is writing to the 
file during copy.


/etc/init.d/weewx stop


sleep 5





# Perform backup


rsync -r        /etc/weewx              /home/pi/myNAS/etc


rsync -r        /usr/share/weewx/user   /home/pi/myNAS/usr


rsync -r        /var/lib/weewx          /home/pi/myNAS/var


rsync -r        /etc/weewx              /media/pi/BACKUP/etc


rsync -r        /usr/share/weewx/user   /media/pi/BACKUP/usr


rsync -r        /var/lib/weewx          /media/pi/BACKUP/var




# Brinf weewx service backup.


/etc/init.d/weewx start



- show quoted text -


On Monday, June 15, 2020 at 9:02:32 AM UTC-4, Frank von Thienen wrote:
>
> Hi all,
>
> I have not much knowlwdge about shell scripting, so I have to ask.
> I need the follwoing action in a shell script, so I can do a cron out of 
> it.
> 1. stop weewx (/etc/init.d/weewx stop)
> 2. ftp the sqlite.db from it's directory to a given directory (outside 
> raspberry) with a time stamp (so time stamp should be added while 
> transferring via ftp
> 3. start weewx (/etc/init.d/weewx start)
>
> can anyone give me a helping hand.
>
> thanks
>
> Frank
>

-- 
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/238668c8-011e-42e8-86ef-7ffb5f9c1fe4o%40googlegroups.com.

Reply via email to