Page 1 of 1

Can the save operation be done in a .sh file? (SOLVED)

Posted: Fri Jun 21, 2024 9:52 pm
by HarveyH

This is my current click on and away it goes "backup.sh" :

sakura -e rsync -avu --delete /mnt/ventoy2 /mnt/sdc1/LinuxBackups
sakura -e sync

(I know. To be more generic, that should be "/mnt/wkg" but the script works as-is and I can fix it later).

First though, I have to click the "Save" icon on the screen to make sure that all the data is current. That's too much work.
Being laz... I mean "frugal", I'd like to have the script do the save operation for me to make sure it is done before the backup starts.


Re: Can the save operation be done in a .sh file?

Posted: Fri Jun 21, 2024 11:40 pm
by williwaw
HarveyH wrote: Fri Jun 21, 2024 9:52 pm

This is my current click on and away it goes "backup.sh" :

sakura -e rsync -avu --delete /mnt/ventoy2 /mnt/sdc1/LinuxBackups
sakura -e sync

(I know. To be more generic, that should be "/mnt/wkg" but the script works as-is and I can fix it later).

First though, I have to click the "Save" icon on the screen to make sure that all the data is current. That's too much work.
Being laz... I mean "frugal", I'd like to have the script do the save operation for me to make sure it is done before the backup starts.

Hi Harvey
looks like it will work. I wrote a simple script for rsync once and it did some ugly stuff and lost data. Cant remember the details, but it was something like if the target wasnt actually mounted....
or maybe if the wrong thing was mounted to the target


Re: Can the save operation be done in a .sh file?

Posted: Sat Jun 22, 2024 12:38 am
by HarveyH

It does work and I use it. I just wanted to add that "save" operation to it.
Also, if the target isn't mounted, the script just craps out and does nothing, so no harm.

Addendum:
Why do I bother with a backup script? Why not just backup the EasyOS.img file?

1) I save that image file when I do my regular WIndows backups. but randomly, the img file gets borked (so the backup is of a borked img) and won't boot. I get errors about not being able to access /etc/fstab*. This way, I have saved the important stuff.

2) I end up with a copy of all the files on an NTFS partition. Windows can access any images or videos that I have downloaded. I use EasyOS as my system for going to websites that likely have malware. Let the website code infect the EasyOS system *if* it can. I don't care. That system can easily be restored to virgin clean and Linux is safer from malware anyway.

3) Redundant backups

* With the V5s of EOS. It's too soon to tell about V6.


Re: Can the save operation be done in a .sh file?

Posted: Mon Jun 24, 2024 6:16 am
by Caramel
HarveyH wrote: Sat Jun 22, 2024 12:38 am

It does work and I use it. I just wanted to add that "save" operation to it.

The code is at the bottom of /usr/bin/ask-save-zram1, the script executed when you click on the Save icon.

Code: Select all

mkdir -p /mnt/${WKG_DEV}/${WKG_DIR}.session-transit
/etc/rc.d/rw-merge '.session-transit

To use it, you need to add

Code: Select all

. /etc/rc.d/PUPSTATE

before so that your script knows WKG_DEV and WKG_DIR


Re: Can the save operation be done in a .sh file? (SOLVED)

Posted: Tue Jun 25, 2024 9:45 pm
by HarveyH

Hot dog! Here is my finished backup system
----------------
BU.sh

#!/bin/bash

sakura -e /usr/bin/ask-save-zram1
sakura -e detox -r -v /files/downloads/

# If sdc isn't mounted, nothing will happen here
sakura -e rsync -avu --delete /mnt/ventoy2/ /mnt/sdc1/LinuxBackups

sakura -e sync
---------------

That "detox" line cleans up the downloaded filenames so I can successfully access them from Windows.