diff options
author | Paul Sokolovsky <paul.sokolovsky@linaro.org> | 2014-11-28 21:31:18 +0200 |
---|---|---|
committer | Paul Sokolovsky <paul.sokolovsky@linaro.org> | 2014-11-28 21:31:18 +0200 |
commit | 39ec4486fb6a90202c685a80fec858de91778fb3 (patch) | |
tree | c83c8fdadbe9ea6d9c3e9ac4e16cf3f5ddffeac6 | |
parent | 7225e131f2850959d9de80e6169c3af85b1d7d06 (diff) |
git-backup: Better error handling.
Change-Id: I7aeb4460b3705368b622f291de60d3946befc42e
-rwxr-xr-x | git-backup/backup.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/git-backup/backup.sh b/git-backup/backup.sh index a5063f7..a3910a6 100755 --- a/git-backup/backup.sh +++ b/git-backup/backup.sh @@ -10,7 +10,7 @@ SSH_AUTH="-A" SSH="ssh $SSH_OPTS" function usage () { - echo "Usage: $0 <user> <host> status|diff|commit" + echo "Usage: $0 <user> <host> status|diff|commit|push" exit 1 } @@ -39,8 +39,14 @@ elif [ "$cmd" = "commit" ]; then $SSH $HOST "cd /var/lib/jenkins; git commit -m \"$msg\" jobs" msg="Capture new jobs" $SSH $HOST "cd /var/lib/jenkins; git add jobs; git commit -m \"$msg\" jobs" + st=$? else $SSH $HOST "cd /var/lib/jenkins; git commit -m \"$msg\" jobs" + st=$? + fi + if [ $st -ne 0 ]; then + echo "*** ERROR ***" + exit 1 fi echo "Jobs are now commited, but not pushed. Run $0 $1 $2 push" elif [ "$cmd" = "push" ]; then |