feat(syncNC): waiting function for psgrep nextcloud

wait 3x20s for nextcloudcmds to finish before exiting
This commit is contained in:
lucas committed 2026-10-26 18:55:04 +01:00
1 parent a81ab49b91
commit 64f2abcdd1
1 file changed
+15 -5
+15 -5
View File
@@ -250,6 +250,20 @@ sync_all() {
return 1
}
wait_for_nextcloud() {
for _ in {1..3}; do
if ! pgrep -x "nextcloudcmd" >/dev/null; then
return 0
fi
echo "Nextcloud sync is already active, waiting 20 seconds..."
sleep 20
done
echo "Nextcloud sync is still active after 3 retries, stopping."
return 1
}
main() {
parse_args "$@"
validate_sync_options
@@ -262,11 +276,7 @@ main() {
die "Cannot read credentials file: $NETRC"
fi
if pgrep -x "nextcloudcmd" >/dev/null; then
echo "Nextcloud sync is already active, stopping."
return 1
fi
wait_for_nextcloud
echo "Starting Nextcloud synchronization..."
sync_all