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

  • 相关阅读:
    Docker基础 ubuntu安装docker
    layui.laytpl 模板引擎用法
    golang 中 strings 包的 Replace 用法介绍笔记
    golang之结构体
    Mysql复习秘籍
    NFS 共享存储
    Rsyncd 同步服务
    企业服务器架构
    基础面试题二
    基础面试题一
  • 原文地址:https://www.cnblogs.com/qdlk/p/7908886.html
Copyright © 2011-2022 走看看