php调用shell脚本的svnup.php文件内容:

<?
set_time_limit(0);
//$output = array();
$ret = 0;
exec("/usr/bin/sudo /data0/shell/svnvp.sh", $output, $ret);
echo "Result:{$ret}";
print_r($output);
?>

/data0/shell/svnvp.sh是更新的脚本,主要内容是svn up。

还需要修改sudo配置文件,直接键如visudo命令编辑配置文件:

1. 注释Defaults requiretty
Defaults requiretty修改为 #Defaults requiretty, 表示不需要控制终端。
否则会出现sudo: sorry, you must have a tty to run sudo

2. 增加行 Defaults visiblepw
否则会出现 sudo: no tty present and no askpass program specified

我发现sudo-1.6.9p17-5.el5是不支持这个参数的,sudo-1.7.2p1-10.el5支持。

3. 赋予www用户执行svn权限
如,增加行:www  ALL=(ALL) NOPASSWD: /data0/shell/svnvp.sh
注:NOPASSWD可以使在命令执行时不需要交互输入www 用户的密码

www用户为nginx或apache的运行用户

4.重启nginx或apache,让用户重新获得权限。

错误提示sudo: no tty present and no askpass program specified Sorry, try again.的更多相关文章

  1. sudo: no tty present and no askpass program specified(转)

    sudo: no tty present and no askpass program specified 2012-11-30 09:30 5040人阅读 评论(1) 收藏 举报 修改sudo配置文 ...

  2. How to fix 'sudo: no tty present and no askpass program'以及硬盘序列号的读写

    在调用system命令读写硬盘序列号的过程中遇到问题,报错如下: sudo: no tty present and no askpass program 发现此问题是由于帐号并没有开启免密码导致的 . ...

  3. sudo: no tty present and no askpass program specified

    sudo: no tty present and no askpass program specified | 学步园 https://www.xuebuyuan.com/2157339.html 通 ...

  4. Jenkins服务使用 宿主机的docker、docker-compose (Jenkins 执行sudo命令时出现“sudo: no tty present and no askpass program specified”,以及 docker-compose command not found解决办法)

    若要转载本文,请务必声明出处:https://www.cnblogs.com/zhongyuanzhao000/p/11681474.html 原因: 本人最近正在尝试CI/CD,所以就使用了 Jen ...

  5. 开启Ubuntu php错误提示 ZT

    开启Ubuntu php错误提示 在Ubuntu下,LAMP中PHP错误是不提示的,只会出现一个空白页.当然,这对于运行的生产环境来说是必须的.但有时候也需要查看生产环境上错误提示,那么只要通用下面简 ...

  6. php开启与关闭错误提示

    windows系统开关php错误提示 如果不具备修改php.ini的权限,可以将如下代码加入php文件中: 代码如下 复制代码 ini_set("display_errors", ...

  7. Ubuntu 17.10 用 apt 搭建 lamp 环境、安装 phpmyadmin、redis 服务+扩展、mysql 扩展、开启错误提示、配置虚拟主机

    2018-02-24 13:50:30 更新: 个人喜欢相对原生又不太麻烦,所以用 apt 构建环境.不过,最近使用到现在记得出现过了 3 次 apache 或 mysql 服务器无法启动或无法连接的 ...

  8. 解决Ubuntu的错误提示

    如果你是一个Ubuntu用户,也许偶尔甚至经常,遇到这样一个错误提示“System Program problem detected”. Ubuntu有一个内建的实用程序叫做Apport, 当一个程序 ...

  9. 开启 PHP 错误提示配置步骤详解

    PHP编码出错不提示,这对于开发来说,是很不方便的.下面讲解如何开启错误提示步骤: 1. 打开php.ini文件. 以我的ubuntu为例,这个文件在: /etc/php5/apache2 目录下. ...

随机推荐

  1. PBR实现2.0

    之前的错误和欠缺 1. 过于简单的划分diffuse和specular,非常光滑的非金属材料也是很能反光的2. 费奈尔效应的处理,F0的选取也比较随意3. 没有GI,更不支持AO 正确划分diffus ...

  2. linux下配置ip地址四种方法(图文方法)

    主要是用第四种方法 (1)Ifconfig命令  第一种使用ifconfig命令配置网卡的ip地址.此命令通常用来零时的测试用,计算机启动后 ip地址的配置将自动失效.具体用法如下.Ipconfig  ...

  3. logback

    logback:入口: private final static Logger logger = org.slf4j.LoggerFactory.getLogger(ServiceTest.class ...

  4. *按类的某一字段排序(Lv)

    给定一个student类,类中有两个属性ID,Score.对一组student类对象排序,写出方法.

  5. JsonException: Max allowed object depth reached while trying to export from type System.Single

    在进行类转json字符串时,报错JsonException: Max allowed object depth reached while trying to export from type Sys ...

  6. (Tree) 101. Symmetric Tree

    Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For e ...

  7. system verilog的一些总结(从其他博客复制来的)

    转载自 http://blog.sina.com.cn/s/blog_e7fec2630101f5t9.html SystemVerilog是一种硬件描述和验证语言(HDVL),它基于IEEE 136 ...

  8. echo同时输出到多个文件中

    echo "test"| tee -a file1 file2 如果想去掉在屏幕上的显示 echo "test"| tee -a file1 file2 > ...

  9. Webpack 入门指南 - 2.模块

    这一次我们谈谈模块问题. 通常我们希望这个项目可以分为多个独立的模块,比如,上一次提高的 hello 函数,如果我们定义为一个模块,其它模块引用之后,直接调用就好了.在前端怎么使用模块呢?这可说来话长 ...

  10. ASP.NET MVC4框架揭秘 源代码下载

    http://files.cnblogs.com/artech/asp.net.mvc.4.samples.rar