diff --git a/functions.sh b/functions.sh index 6ea097e..b88a9fa 100644 --- a/functions.sh +++ b/functions.sh @@ -7,7 +7,8 @@ dlob=$(tput sgr0) notesSync() { # check if online test="git.sr.ht" - if timeout 0.5 ping -q -c 1 -W 1 $test >/dev/null; then + time="0.5" + if timeout $time ping -q -c 1 -W 1 $test >/dev/null; then { path="${notes_dir}/" cd "$path" @@ -15,10 +16,13 @@ notesSync() { git add . git commit -m "[bash script] update/add entries" >> /dev/null git push --quiet + echo ">>> Sync success" } || { # Report; TODO: write log echo ">>> Sync failed" } + else + echo ">>> Sync skipped due to timeout ($time)" fi }