systemd:在service文件中给Exec传入多个参数
原问题是这样的:

答案是这样的:

此外在使用prometheus监控mongodb时需要安装prometheus-mongodb-exporter,过程中也发现这种用法:

看看service单元文件是怎么写的:
cat /lib/systemd/system/prometheus-mongodb-exporter.service
内容如下:
[Unit]
Description=Prometheus exporter for MongoDB
Documentation=https://github.com/dcu/mongodb_exporter
[Service]
Restart=always
User=prometheus
EnvironmentFile=/etc/default/prometheus-mongodb-exporter
ExecStart=/usr/bin/prometheus-mongodb-exporter $ARGS
[Install]
WantedBy=multi-user.target
在看看这个 EnvironmentFile:
cat /etc/default/prometheus-mongodb-exporter
内容如下:
# Set the command-line arguments to pass to the server.
ARGS='-mongodb.uri="mongodb://localhost:27017"'
systemd:在service文件中给Exec传入多个参数的更多相关文章
- mybatis中sql语句传入多个参数方法
1 使用map <select id="selectRole" parameterType="map" resultType="RoleMap& ...
- linux 服务注册 service文件 在service文件中设置变量和环境变量
[Unit] Description= #服务描述 After=syslog.target #服务启动依赖 [Service] Type=forking #服务启动类型 可 ...
- Systemd Unit文件中PrivateTmp字段详解-Jason.Zhi
如下图,在开发调试的时候会遇到这么一个问题. file_put_contents时,$tmp_file显示的目标文件是/tmp/xxx.而这个文件实际放在linux的目录却是/tmp/systemd- ...
- Centos7之Systemd(Service文件)详解
一.开机启动 对于那些支持 Systemd 的软件,安装的时候,会自动在/usr/lib/systemd/system目录添加一个配置文件. 如果你想让该软件开机启动,就执行下面的命令(以httpd. ...
- divmod(a,b)函数是实现a除以b,然后返回商与余数的元组、eval可以执行一个字符串形式的表达式、exec语句用来执行储存在字符串或文件中的Python语句
#!/usr/bin/env python a = 10/3 print(a) #divmod计算商与余数 r = divmod(10001,20) print(r) #eval可以执行一个字符串形式 ...
- log4j根据包名 日志输出到不同文件中 , service层无法输出日志问题
1. service 层因为要配置事务,使用了代理 <aop:config proxy-target-calss=''true"> <aop:pointcut id=&qu ...
- 使用exec函数将当前的信息输入到文件中
先来看看exec函数: exec函数族 fork创建子进程后执行的是和父进程相同的程序(但有可能执行不同的代码分支),子进程往往要调用一种exec函数以执行另一个程序.当进程调用一种exec函 ...
- 简洁的 systemd 操作指南Linux下Service文件服务说明(转)
1.服务权限systemd有系统和用户区分:系统(/user/lib/systemd/system/).用户(/etc/lib/systemd/user/). 一般系统管理员手工创建的单元文件建议存放 ...
- mapper.xml文件中传入list参数报错 ‘ ’附近有语法错误
mapper.xml文件中传入list参数,使用foreach循环遍历值,但是在遍历的过程中出错了,具体代码如下所示 mapper.xml <select id="selectByCo ...
随机推荐
- Flask中的中间件
flask也有和Django类似的中间件,不同的是使用三个装饰器来实现的. .berore_request在请求进入视图之前 @app.before_request def be1 bef be2 b ...
- 【leetcode】1081. Smallest Subsequence of Distinct Characters
题目如下: Return the lexicographically smallest subsequence of text that contains all the distinct chara ...
- elememt-ui 的 el-icon-iconName 图标 显示问题!
今天想在按钮处添加一个图标,但是显示不出.自己找了半天,终于找到了,希望帮到大家! 1,首先是没有报错的,但是有警告⚠ 意思是说什么拦截了之类的问题,但是到底是哪里问题导致拦截了呢?找了好久,原来是我 ...
- Android之SAX解析笔记
books.xml: <?xml version="1.0" encoding="utf-8"?> <books> <book i ...
- spring boot整合quartz定时任务案例
1.运行环境 开发工具:intellij idea JDK版本:1.8 项目管理工具:Maven 4.0.0 2.GITHUB地址 https://github.com/nbfujx/springBo ...
- Python_007(深浅拷贝)
一.基础数据类型的补充 1.其他类型之间的相互转换 例如:str = int(str) str => int; int = list(int) int => list; tuple = ...
- Jenkins报错:该Jenkins实例似乎已离线
解决方法: 1.保留此离线页面,重新开启一个浏览器tab标签页 2.输入输入网址http://localhost:8080/pluginManager/advanced 3.进入该页面最底下,找到[升 ...
- CTF_工具网址收藏
杂项 条形码在线扫描 : https://online-barcode-reader.inliteresearch.com/ PS弄反色ctr+i : https://zhidao.ba ...
- Qt5.1 静态编译
下载Qt5.2.1的Qt-every 解压 cd qt-everywhere-opensource-src-5.1.1/ ./configure -prefix 安装目录 -release -sta ...
- 用maven给SpringBoot项目打包
注意要点: 1.注意某个moule有依赖需要在对应的pom.xml里填写有关的信息,如: <dependencies> <dependency> <artifactId& ...