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 ...
随机推荐
- 获取kingeditor编辑器内容
//初始化编辑器 var editorMini = KindEditor.create('.editor-mini',{ width : '70%', height : '250px', resize ...
- tar解压命令
解压 tar –xvf file.tar //解压 tar包 tar -xzvf file.tar.gz //解压tar.gz tar -xjvf file.tar.bz2 //解压 tar.bz2 ...
- Oracle分组函数之Grouping Sets
功能介绍: 自定义分组的字段 创建表: 插入测试数据: Grouping Sets(null,t.classid,(t.classid,t.studentname)),类似于ROLLUP Select ...
- LRU management
LRU management 字典树用来查找值,实现map<string,int>操作 tips:tot必须从一开始QAQ #include<bits/stdc++.h> us ...
- HDU | Friend Chains-4460 SPFA
题目: Problem DescriptionFor a group of people, there is an idea that everyone is equals to or less th ...
- xsxsxsxsxsxsxsxs
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Conten ...
- IBatis.Net 下使用SqlBulkCopy 大批量导入数据 问题解决
SQLBulkCopy是继承SQLClient空间下的一个特殊类,它可以帮助我们以映射的方式把DataTable和DataReader数据大批量导入到数据库对应表中 public void Inert ...
- Embedding理解与代码实现
https://blog.csdn.net/songyunli1111/article/details/85100616
- Schema 与数据类型优化
这是<高性能 MySQL(第三版)>第四章<Schema 与数据类型优化>的读书笔记. 1. 选择优化的数据类型 数据类型的选择原则: 越小越好:选择满足需求的最小类型.注意, ...
- WPF数据模板中绑定事件不触发问题
今天比较闲,做一个练手的项目,结果在xaml中写了一个用户的数据模板后,在其中的某个Canvas上绑定了一个鼠标左击的事件,结果调试的时候,无论怎么点击都不跳到断点那里,百思不得其解. 之后尝试不绑定 ...