zoukankan      html  css  js  c++  java
  • jenkins job起停远程slave机器上的系统服务

    目标:jenkins job起停远程slave机器上的系统服务

    问题1: 将jenkins用户加到root和wheel用户组后,执行系统命令时提示输入密码
    [jenkins@hostname ~]$ groups
    jenkins root wheel docker
    [jenkins@hostname ~]$ systemctl start postfix
    ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
    Authentication is required to manage system services or units.
    Authenticating as: jenkins
    Password:
    [jenkins@hostname ~]$ sudo systemctl start postfix
    [sudo] password for jenkins:

    解决办法:
    vi /etc/sudoers

    ## Allows people in group wheel to run all commands
    #%wheel ALL=(ALL)       ALL

    ## Same thing without a password
    %wheel  ALL=(ALL)       NOPASSWD: ALL

    问题2: jenkins job远程起停服务时报错如下
    [start_smtp] $ /bin/sh -xe /tmp/jenkins2922363617810746173.sh
    + sudo systemctl start postfix
    sudo: sorry, you must have a tty to run sudo

    解决办法:
    vi /etc/sudoers
    # Defaults    requiretty

  • 相关阅读:
    Linux 清理boot分区
    Linux 虚拟内存
    使用mongoskin操作MongoDB
    nodejs操作session和cookie
    nodejs接收get参数和post参数
    Tomcat--在IDEA创建Java Web项目,通过tomcat启动
    Tomcat--配置
    Mac安装Tomcat
    XML--解析
    XML--约束
  • 原文地址:https://www.cnblogs.com/qdlk/p/7908886.html
Copyright © 2011-2022 走看看