liux下crontab定时执行shell脚本示例

crontab -l 中写的脚本

* * * * * php /home/wwwroot/waima/ald.waima.com/artisan schedule:run 1>> /dev/null 2>&1
* * * * * php /home/wwwroot/waima/hzy.waima.com/artisan schedule:run 1>> /dev/null 2>&1
* * * * * sleep 30; /home/wwwroot/waima/yyw.waima.com/artisan schedule:run 1>> /dev/null 2>&1
* * * * * sleep 30; /bin/bash /home/shell/svn_up_automatic.sh >> /dev/null 2>&1

 

shell脚本中的代码


#!/bin/bash

app_path='/home/wwwroot/waima/ccc.waima.com'
app_domain='ccc.waima.com'
log_path='/home/shell/waima/log/svn_up_ccc.log'
svn update ${app_path} > ${log_path}
chown -R www:www ${app_path}/storage
chmod -R 755 ${app_path}/storage
chown -R www:www ${app_path}/public
chmod -R 755 ${app_path}/public
chown -R www:www ${app_path}/bootstrap
chmod -R 755 ${app_path}/bootstrap
echo ${app_domain}" is deployed";

posted on 2018-03-13 16:39  guoke1970s  阅读(123)  评论(0编辑  收藏  举报

导航