After several issues with syncthing, I’d like to put on my own syncronization, also relying on the availability on MuOS of rclone and rsync.
This way I’d have total control on what would be synced and most importantly how, plus I could send me telegram notifications in case of failure, and stuff like that.
Having a folder where to put scripts that would be ran before shutting off would be awesome for this purpose. I hope others might benefit of this. Thanks for caring.
2 Likes
I think that is already implemented, in a way. There is a shutdown script.
Busybox uses init.d. Embedded Linux Development Tutorial | Timesys LinuxLink
The most important entries on systems that use the BusyBox SysVinit work-alike are the following:
::sysinit:/etc/init.d/rcS
::shutdown:/etc/init.d/rcK
The first of these entries runs the /etc/init.d/rcS script when the system boots. The second of these runs the /etc/init.d/rcK script when the system is being shut down. Both of these scripts execute other script files that begin with the letter S (startup) or K (kill), followed by a two-digit integer value to enforce the order in which they are executed. These script files are also located in the /etc/init.d directory. Script files beginning with the letter S are executed in increasing numerical order, while those beginning with the letter K are executed in decreasing numerical order. Example file names are S01-udevd, S02-mount, and so on.
When running system startup scripts through the /etc/init.d/rcS script, that script also executes the /etc/rc.local script after processing all startup scripts. This file is typically used to execute system-specific startup commands, enabling customization of the startup process for a specific machine without making general changes to the standard startup scripts for that system.
I would not advise you to do network io on shutdown.
I had a setup on arkos, using a network daemon that synced my saves on wifi connect. Another one to turn on the wifi when charging, turn off when plugged out. It was built relying on system.d which muos does not have, for very valid reasons.
From what i have read syncthing is unreliable on my brick, and its quite power hungry on a machine with a tiny battery.