#!/bin/bash
# 把静态文件push到服务器仓库上
echo "******正在push static to server******"
cd /home/lufeng/assets
git push origin master
# 把工程文件push到服务器仓库上
echo "******正在push projects to server******"
cd /home/lufeng/projects/dashixiong
git push origin master
echo "******已登录远程服务器******"
ssh -tt rockcy << remotessh
# 合并仓库代码
echo "******合并仓库代码******"
cd /home/static/kaisa_static
git pull origin master
cd
cd /home/projects/dashixiong
git pull origin master
echo "******更新成功******"
exit
# 把静态文件push到服务器仓库上
echo "******正在push static to server******"
cd /home/lufeng/assets
git push origin master
# 把工程文件push到服务器仓库上
echo "******正在push projects to server******"
cd /home/lufeng/projects/dashixiong
git push origin master
echo "******已登录远程服务器******"
ssh -tt rockcy << remotessh
# 合并仓库代码
echo "******合并仓库代码******"
cd /home/static/kaisa_static
git pull origin master
cd
cd /home/projects/dashixiong
git pull origin master
echo "******更新成功******"
exit
remotessh
参考链接:http://www.3mu.me/linux%E4%B8%AD%E7%9A%84shell%E7%94%A8ssh%E8%87%AA%E5%8A%A8%E7%99%BB%E5%BD%95%E8%BF%9C%E7%A8%8B%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%90%8E%E6%89%A7%E8%A1%8C%E5%91%BD%E4%BB%A4%E5%B9%B6%E8%87%AA%E5%8A%A8/
http://www.ibm.com/developerworks/cn/aix/library/0909_jinjh_unixlogin/