From 9c881c366e6cb1fbfe572587690b8467ff55185e Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Mon, 20 May 2019 17:05:13 +0200 Subject: [PATCH] =?UTF-8?q?Modification=20pour=20lancer=20le=20script=20et?= =?UTF-8?q?=20=C3=A9viter=20le=20spam=20de=20wall=20vides?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Perso/INTech/gitUpdate.sh | 8 ++++++-- Perso/systemd_timers/gitUpdate.service | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Perso/INTech/gitUpdate.sh b/Perso/INTech/gitUpdate.sh index 629642d..9fb8f76 100755 --- a/Perso/INTech/gitUpdate.sh +++ b/Perso/INTech/gitUpdate.sh @@ -47,7 +47,7 @@ for GIT_REPO in $work_array ; do remoteStatus="$(git fetch --dry-run 2>&1 | tail -n 1 | grep -v -e'+')" # Empty if there are no commits to fetch localStatus="$(git push -n --porcelain | grep -e'up to date')" # Empty if there are commits to push - { + output=$( if [ -z "$remoteStatus" ]; then if [ -z "$localStatus" ]; then echo "Pushing "$GIT_REPO" updates to origin" @@ -64,8 +64,12 @@ for GIT_REPO in $work_array ; do git remote update 2>&1 exit 1 fi - fi } | wall + fi ) + if [ ! -z "$output" ]; then + echo "$output" | wall + fi + done exit 0 \ No newline at end of file diff --git a/Perso/systemd_timers/gitUpdate.service b/Perso/systemd_timers/gitUpdate.service index a38072d..90e03de 100644 --- a/Perso/systemd_timers/gitUpdate.service +++ b/Perso/systemd_timers/gitUpdate.service @@ -4,4 +4,4 @@ Description=Updates git repos [Service] Type=oneshot User=intech -ExecStart=/bin/bash ~/git_repos/gitUpdate.sh "/home/intech/git_repos/TechTheTachyon-HighLevel.git" "/home/intech/git_repos/TechTheTachyon-LowLevel.git" \ No newline at end of file +ExecStart=/bin/bash /home/intech/git_repos/gitUpdate.sh "/home/intech/git_repos/TechTheTachyon-HighLevel.git" "/home/intech/git_repos/TechTheTachyon-LowLevel.git" \ No newline at end of file