linux上PHP网页内容不能更新,linux+php+svn update+中文问题不能更新svn

1。写shell脚本

!#/bin/sh

svn --username hanhh --password 111111 up  https://192.168.1.223/svn/website_php/source /data/www/navidog.cn/

2。运行命令:crontab -e

3。添加每分钟都执行脚本:* * * * * /bin/sh /data/shell/svn.sh  > /dev/null 2>&1

* * * * * /bin/sh /data/shell/svn.sh  这个没有添加 /dev/null 的可以在 tail -f /var/spool/mail/root 中查看错误

4. tail -f /var/log/cron:查看crontab 的运行日志

5。这个中文问题可以在执行脚本中添加环境变量 ,就可以更新了

!#/bin/sh

source /etc/profile

svn --username hanhh --password 111111 up  https://192.168.1.223/svn/website_php/source /data/www/navidog.cn/

以下是示例代码

if($_GET['opt'] == 'up'){

$checkout = "svn --username hanhh --password 111111 up  https://192.168.1.223/svn/website_php/source /data/www/navidog.cn";

//$checkout = "svn --username hanhh --password 111111 up  http://192.168.1.223/svn/website_php/source /data/www/tmp";

$output = array();

$tmp = exec($checkout,$output);

if(is_array($output) && !empty($output))

foreach($output as $k=>$v){

echo "$v
";

}

}elseif($_GET['opt'] == 'stream'){

$svn_user = "hanhh";

$svn_pwd = "111111";

$svn_co_dir =" https://192.168.1.223/svn/website_php/source";

$itme_dir = '/data/www/tmp';

header("Cache-Control:no-cache,must-revalidate");

$handle = popen("svn up --username {$svn_user} --password {$svn_pwd} $svn_co_dir $itme_dir", 'r');

$read = stream_get_contents($handle);//需要 PHP5 或更高版本

echo "

";

printf($read);

echo "

";

pclose($handle);

}else{

?>

}?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值