# 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"
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=$?
#################################################################################
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