首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在RedHat/CentOS中作为服务运行二进制文件

在RedHat/CentOS中作为服务运行二进制文件
EN

Server Fault用户
提问于 2019-04-15 06:55:36
回答 1查看 1.9K关注 0票数 1

我已经创建了一个脚本来作为服务执行二进制文件。但是服务没有启动服务,但是当我停止服务时,它显示了多个pids。

我正在使用RHEL 7,这是完整的细节

代码语言:javascript
复制
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

通常,我们按照以下./pipeline --config pipeline.conf方式运行脚本

代码语言:javascript
复制
[Unit]
Description=Pipeline service

[Service]
Type=simple
User=cisco
ExecStart=/hfqp/bin/pipeline --config /hfqp/bin/pipeline.conf

然后做了以下的事情

代码语言:javascript
复制
systemctl daemon-reload
systemctl start pipeline.service

即使这样也行不通。

这是错误日志

代码语言:javascript
复制
● pipeline.service - Pipeline service
   Loaded: loaded (/etc/systemd/system/pipeline.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2019-04-16 06:29:34 GMT; 19s ago
  Process: 10195 ExecStart=/home/cisco/bigmuddy-network-telemetry-pipeline/bin/executePipeline.sh --daemon (code=exited, status=1/FAILURE)
 Main PID: 9962 (code=exited, status=1/FAILURE)

Apr 16 06:29:07 matrix-pipeline-b-01 systemd[1]: Starting Pipeline service...
Apr 16 06:29:32 matrix-pipeline-b-01 sudo[10196]: pam_unix(sudo:auth): conversation failed
Apr 16 06:29:32 matrix-pipeline-b-01 executePipeline.sh[10195]: sudo: no tty present and no askpass program specified
Apr 16 06:29:32 matrix-pipeline-b-01 sudo[10196]: pam_unix(sudo:auth): auth could not identify password for [cisco]
Apr 16 06:29:34 matrix-pipeline-b-01 systemd[1]: pipeline.service: control process exited, code=exited status=1
Apr 16 06:29:34 matrix-pipeline-b-01 systemd[1]: Failed to start Pipeline service.
Apr 16 06:29:34 matrix-pipeline-b-01 systemd[1]: Unit pipeline.service entered failed state.
Apr 16 06:29:34 matrix-pipeline-b-01 systemd[1]: pipeline.service failed.

任何帮助都是非常感谢的。

EN

回答 1

Server Fault用户

回答已采纳

发布于 2019-04-18 19:41:01

您看过下面的错误消息了吗?

代码语言:javascript
复制
Apr 16 06:29:32 matrix-pipeline-b-01 executePipeline.sh[10195]: sudo: no tty present and no askpass program specified
Apr 16 06:29:32 matrix-pipeline-b-01 sudo[10196]: pam_unix(sudo:auth): auth could not identify password for [cisco]

看来cisco用户无法运行具有sudo权限的命令,因为这很可能是一个非交互式脚本。您可以通过编辑/etc/sudoers文件来授予无密码sudo。

代码语言:javascript
复制
$ sudo visudo
# Add a line like this to /etc/sudoers
# username ALL = NOPASSWD: /fullpath/to/command, /fullpath/to/othercommand
cisco ALL = NOPASSWD: /hfqp/bin/pipeline --config /hfqp/bin/pipeline.conf
票数 6
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/963068

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档