From 4cdf77a295bc62466a24c7a2aabd893b4bd09554 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Thu, 27 Apr 2023 17:13:50 +0800 Subject: Update --- bin/init/sync.sh | 18 +++++++----------- bin/unix/timer.sh | 2 +- bin/wakeup.sh | 4 +--- 3 files changed, 9 insertions(+), 15 deletions(-) (limited to 'bin') diff --git a/bin/init/sync.sh b/bin/init/sync.sh index ffd91c0..fb939e3 100755 --- a/bin/init/sync.sh +++ b/bin/init/sync.sh @@ -5,15 +5,16 @@ pidof git >/dev/null && exit 0 # my repo sync() { - { - cd $1 && [[ -n `git remote -v` ]] || return - } 2>/dev/null + cd "$1" || return + [ -z "$(git remote -v)" ] && return + + pwd GIT_SSH_COMMAND="ssh -o ControlMaster=no" git pull --quiet || echo Has trouble when syncing `pwd` } -while read repo; do - sync $repo & -done <~/.repos +sed /^#/d ~/.repos | while read -r repo; do + eval "sync $repo &" +done while true; do if test $(jobs -r | wc -l) -gt 0; then @@ -26,8 +27,3 @@ done & # others repo #check_upstream ~/git/tig || echo in `pwd` >/dev/tty & - -# thunderbird -#if [[ `cat /etc/hostname` != 'vultr' ]]; then -# rsync -a pham@topo.tw:~/.thunderbird/ ~/.thunderbird & -#fi diff --git a/bin/unix/timer.sh b/bin/unix/timer.sh index ac89c52..c87a836 100755 --- a/bin/unix/timer.sh +++ b/bin/unix/timer.sh @@ -81,7 +81,7 @@ timer() { done } -trap 'exec 1>&3; [ -n "COMMAND_EXIT" ] && eval "$COMMAND_EXIT" && unset COMMAND_EXIT; date >>/tmp/timer.sh; echo $(trap -l $1 | cut -f 2 -d" ") >>/tmp/timer.sh' EXIT HUP +trap 'exec 1>&3; [ -n "COMMAND_EXIT" ] && eval "$COMMAND_EXIT" && unset COMMAND_EXIT; echo `date` $1 >>/tmp/timer.sh; ' EXIT HUP while [ $count -lt $SET ]; do [ $stop = true ] && sleep 0.3 && continue diff --git a/bin/wakeup.sh b/bin/wakeup.sh index 0621c83..87d5727 100755 --- a/bin/wakeup.sh +++ b/bin/wakeup.sh @@ -11,9 +11,7 @@ find $SETTING_DIR/bin -type f -executable -exec realpath {} + | \ xargs -I{} ln -sf {} $BIN_DIR # sync with important git repos -setsid ~/bin/sync.sh && \ -which notify-send &>/dev/null && \ -notify-send 'Repos synced' +~/bin/sync.sh # Copy context file from vps rsync -au vps:~/.context ~/.context -- cgit v1.2.3-70-g09d2