How to ensure rclone sync before shut down?

New to Puppy and have questions? Start here

Moderator: Forum moderators

Post Reply
LANdpLAN
Posts: 106
Joined: Tue May 14, 2024 4:26 pm
Has thanked: 19 times
Been thanked: 7 times

How to ensure rclone sync before shut down?

Post by LANdpLAN »

How can I make sure that rclone has synced everything before shutting down bwpup.
I think I'm having problems with a database because I often have to restore the dropbox file due to corruption. I'm thinking this is being caused because when I finish working on it I'm tired and ready for bed so I close and save my work and then shut down the computer. Currently I'll try watching the Up:k/s and when it flat lines Ill shutdown.
I wonder if there is a better way?

Last edited by Flash on Sun Jan 12, 2025 2:03 pm, edited 1 time in total.
Reason: Made the original subject line into a question

BWPUP 10.0.9 on persistent USB

User avatar
Trapster
Posts: 228
Joined: Sat Aug 01, 2020 7:44 pm
Location: Texas
Has thanked: 2 times
Been thanked: 71 times

Re: How to ensure rclone sync before shut down?

Post by Trapster »

I don't have rclone but if you're running it in a script, you can always add this to the end of the script:

Code: Select all

xmessage -center "sync is complete"
fernan
Posts: 147
Joined: Sat Sep 19, 2020 3:35 am
Has thanked: 54 times
Been thanked: 24 times

Re: How to ensure rclone sync before shut down?

Post by fernan »

found on the Internet, about using rclone with the "-v" parameter

"If you use -v rclone will print a little summary at the end."

User avatar
wizard
Posts: 2169
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2980 times
Been thanked: 799 times

Re: How to ensure rclone sync before shut down?

Post by wizard »

Maybe just a little script that runs rclone, then shuts the system down an hour later.

wizard

Big pile of OLD computers

robertstein
Posts: 10
Joined: Thu Jun 13, 2024 5:23 pm

Re: How to ensure rclone sync before shut down?

Post by robertstein »

You can ensure rclone finishes syncing before shutdown by using a simple shutdown script. Create a script that runs rclone sync and only shuts down once syncing is complete.

1. Create the script:
Open a terminal and run:

Code: Select all

echo -e "#!/bin/sh\nrclone sync /path/to/local/dir remote:backup && poweroff" > /root/safe_shutdown.sh
chmod +x /root/safe_shutdown.sh

2. Use the script to shut down:
Instead of shutting down manually, run:

Code: Select all

/root/safe_shutdown.sh

This ensures that rclone fully syncs your files before the system powers off.

LANdpLAN
Posts: 106
Joined: Tue May 14, 2024 4:26 pm
Has thanked: 19 times
Been thanked: 7 times

Re: How to ensure rclone sync before shut down?

Post by LANdpLAN »

robertstein wrote: Wed Feb 19, 2025 5:45 pm

You can ensure rclone finishes syncing before shutdown by using a simple shutdown script. Create a script that runs rclone sync and only shuts down once syncing is complete.

1. Create the script:
Open a terminal and run:

Code: Select all

echo -e "#!/bin/sh\nrclone sync /path/to/local/dir remote:backup && poweroff" > /root/safe_shutdown.sh
chmod +x /root/safe_shutdown.sh

2. Use the script to shut down:
Instead of shutting down manually, run:

Code: Select all

/root/safe_shutdown.sh

This ensures that rclone fully syncs your files before the system powers off.

How can I modify the existing shutdown script? The script that runs when I press this

Attachments
Screenshot(1).png
Screenshot(1).png (41.56 KiB) Viewed 252 times

BWPUP 10.0.9 on persistent USB

fernan
Posts: 147
Joined: Sat Sep 19, 2020 3:35 am
Has thanked: 54 times
Been thanked: 24 times

Re: How to ensure rclone sync before shut down?

Post by fernan »

the logout menu is called logout_gui , and when you press the shutdown button, it runs the wmpoweroff command.

I think the easiest way would be to rename the original wmpoweroff command and create instead a link to your new shutdown script, called wmpoweroff in the same folder. Do a file search to check if there are other links or instances of the original wmpoweroff. If they are all links to the original file, all of them will work with your new wmpoweroff.

The hardest way would be to modify logout_gui to point to your new script instead of launching the original wmpoweroff

Post Reply

Return to “Beginners Help”