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

Moderator: BarryK

Post Reply
HarveyH
Posts: 96
Joined: Wed Oct 18, 2023 8:40 pm
Been thanked: 21 times

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

Post 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.

Last edited by HarveyH on Tue Jun 25, 2024 9:44 pm, edited 1 time in total.
williwaw
Posts: 1957
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 172 times
Been thanked: 370 times

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

Post 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

HarveyH
Posts: 96
Joined: Wed Oct 18, 2023 8:40 pm
Been thanked: 21 times

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

Post 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.

Caramel
Posts: 476
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 100 times
Been thanked: 78 times

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

Post 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

HarveyH
Posts: 96
Joined: Wed Oct 18, 2023 8:40 pm
Been thanked: 21 times

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

Post 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.

Post Reply

Return to “EasyOS”