shell脚本 githooks 放在服务器 /bin目录下
#!/bin/bash
step=3 #间隔的秒数
for (( i = 0; i < 60; i=(i+step) )); do
# 保存当前目录
currentDir=$PWD
echo "Start to publish...\n"
# 切换到项目目录
cd /opt/work/dnmp/www/localhost/im
# 执行git命令
git pull
# 切换回原来的目录
cd $currentDir
# 删除缓存
# todo
echo "Success\n";
sleep $step
done
exit 0
crontab 每分钟执行一次