Back up script

A category for tips and tricks or off-topic things
mexjerry
Posts: 21
Joined: Mon Apr 11, 2016 6:54 pm

Back up script

Post by mexjerry » Wed Apr 12, 2017 1:41 pm

A power problem resulted in a non-bootable Pi. I have since installed Archpi once again, from scratch.
I am able to view the file /srv/http/ on the corrupt disk using debugfs, however, it is not mountable, and therefore I am not able to copy anything. At this time I am making a copy of the disk, using DD, and hope to salvage the information.
There was mention of a back-up script in previous posts, would that be available somewhere?
thanks
jerry

jeanmarc
Posts: 2028
Joined: Thu Aug 29, 2013 7:16 am

Re: Back up script

Post by jeanmarc » Wed Apr 12, 2017 4:33 pm

did you try to fsck -a /dev/yourdrive ?

mexjerry
Posts: 21
Joined: Mon Apr 11, 2016 6:54 pm

Re: Back up script

Post by mexjerry » Wed Apr 12, 2017 8:19 pm

Thanks jeanmarc
The dd copy is still progressing, when it completes I will attempt what you have suggested.

mexjerry
Posts: 21
Joined: Mon Apr 11, 2016 6:54 pm

Re: Back up script

Post by mexjerry » Sat Apr 15, 2017 12:47 pm

I have not forgot this thread, ddrescue is still running 173807 seconds and counting!
Thats 48.25 hours.
thanks
jerry

mexjerry
Posts: 21
Joined: Mon Apr 11, 2016 6:54 pm

Re: Back up script

Post by mexjerry » Sun Apr 16, 2017 5:05 pm

After over 68 hours, I have a copy of the bad disk, and secured a copy of the data.
The data from the bad disk was copied to /srv/http/123solar/data/invt1/csv on the new install disk.
An ls -all of the above:

-rw-r--r-- 1 http http 20791 Apr 16 10:52 20160715.csv

which is the same permissions of the current files.
Selecting the Production tab in 123solar, I expected to see the production split into the current year, and the previous year, I only see the current year production total.
I copied a total of 97 files from last year, into the /srv/http/123solar/data/invt1/csv file.
What am I missing.
thanks
jerry

jeanmarc
Posts: 2028
Joined: Thu Aug 29, 2013 7:16 am

Re: Back up script

Post by jeanmarc » Sun Apr 16, 2017 7:45 pm

You're that patient ;)
/data/invt1/csv/ is for detailled files. You need to import /data/invt1/production/energy*.csv.

It is wise to make a backup of the data folder.. I do that daily with a ftp script.

mexjerry
Posts: 21
Joined: Mon Apr 11, 2016 6:54 pm

Re: Back up script

Post by mexjerry » Sun Apr 16, 2017 9:55 pm

Thanks
Care to share the script?
Thanks for the pointer on where the files need to go
jerry

jeanmarc
Posts: 2028
Joined: Thu Aug 29, 2013 7:16 am

Re: Back up script

Post by jeanmarc » Mon Apr 17, 2017 6:54 am

Sure, it is here. I daily backup the whole www directory to my nas.
Edit the scripts then
  • systemctl enable backup.timer
  • systemctl start backup.timer
  • systemctl status backup.timer
Did you restored your production data ?

mexjerry
Posts: 21
Joined: Mon Apr 11, 2016 6:54 pm

Re: Back up script

Post by mexjerry » Mon Apr 17, 2017 1:37 pm

Got it all
thanks for the help and script
jerry

giufiore
Posts: 8
Joined: Mon Dec 23, 2019 3:42 pm

Re: Back up script

Post by giufiore » Sat Dec 28, 2019 7:06 pm

jeanmarc wrote:
Mon Apr 17, 2017 6:54 am
Sure, it is here. I daily backup the whole www directory to my nas.
Edit the scripts then
  • systemctl enable backup.timer
  • systemctl start backup.timer
  • systemctl status backup.timer
Did you restored your production data ?
Hi, I am interested in daily backup of my logger.
I have done all the things above, but the backup doesn't work.
If I execute the script manually in the line command, it works fine.
what did i do wrong?

Thanks

Code: Select all

[alarm@Plugbox ~]$ systemctl status backup.timer
* backup.timer - Backup
     Loaded: loaded (/etc/systemd/system/backup.timer; enabled; vendor preset: disabled)
     Active: active (waiting) since Wed 2019-12-25 19:35:43 CET; 2 days ago
    Trigger: Sun 2019-12-29 00:00:00 CET; 4h 59min left
   Triggers: * backup.service

Code: Select all

[alarm@Plugbox ~]$ systemctl status backup.service
* backup.service - Backup
     Loaded: loaded (/etc/systemd/system/backup.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Sat 2019-12-28 00:00:00 CET; 19h ago
TriggeredBy: * backup.timer
    Process: 31045 ExecStart=/home/backup_nas.sh (code=exited, status=203/EXEC)
   Main PID: 31045 (code=exited, status=203/EXEC)

Dec 28 00:00:00 Plugbox systemd[1]: Starting Backup...
Dec 28 00:00:00 Plugbox systemd[31045]: backup.service: Failed to execute command: No such file or directory
Dec 28 00:00:00 Plugbox systemd[31045]: backup.service: Failed at step EXEC spawning /home/backup_nas.sh: No such file or >
Dec 28 00:00:00 Plugbox systemd[1]: backup.service: Main process exited, code=exited, status=203/EXEC
Dec 28 00:00:00 Plugbox systemd[1]: backup.service: Failed with result 'exit-code'.
Dec 28 00:00:00 Plugbox systemd[1]: Failed to start Backup.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests