]> git.nbdom.net Git - nb.git/commitdiff
nb-update
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 28 Jul 2015 19:42:05 +0000 (20:42 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 28 Jul 2015 19:42:05 +0000 (20:42 +0100)
bin/nb-update
etc/bashrc.function

index d756fd373ff23ddea5eba07931907495361f737a..93b668c8943e826578735bff165c9b5c57ad9979 100755 (executable)
@@ -4,6 +4,8 @@
 # Call by cron/etc/nb
 #
 #####################################################################
+#su nico -c "cd /opt/nb && git -C /opt/nb pull"
+#exit
 . "${BASH_SOURCE%/*}/../etc/profile" || exit
 declare -r NAME="$(basename "${0}")"
 declare -r TMP="/tmp/$NAME.tmp"
@@ -40,7 +42,7 @@ for repo in \
   if [ "$USER" == "$user" ]; then
     timeout 30 git pull
   else
-    timeout 30 su $user -c "cd \"$repo\" && git pull"
+    timeout 30 su $user -c "GIT_SSH=$TMP cd \"$repo\" && git pull"
   fi
 
   ret=$?
index b0ec6b54a245a246cfc4e5f777f8d10dcd0840d8..2ec017834927bb971e732ca40e23a1b3bd736bd3 100644 (file)
@@ -5,7 +5,7 @@
 #################################################################################
 if ! which timeout 1>/dev/null; then
 timeout() {
-  perl -e 'alarm(shift @ARGV); exec @ARGV' -- $@
+  perl -e 'BEGIN{$|=1}; alarm(shift @ARGV); exec join(" ",@ARGV)' -- $@
 }
 fi