CentOS7 设置一开机自动运行Git Pull

1. 把git pull的指令写在rc.local

nano /etc/rc.d/rc.local
sh -c 'cd /var/www/html/dir && git pull'

我网上找到这个指令,就是跑不了

git --git-dir=some/dir/.git pull origin master

2. 设置rc.local 运行权限

chmod u+x /etc/rc.d/rc.local

3. 设置开始运行,和开机自动启动

systemctl start rc-local
systemctl enable rc-local

 

Loading

Facebook评论