[root@zbs-staging-api system]# cat /lib/systemd/system/ncmulti@.service
[Unit]
Description=many on %i
After=network.target [Service]
PIDFile=/var/run/nc.%i.pid
#Type=forking
ExecStart=/usr/bin/nc -l %i # 命令行执行时在@后传递变量 [Install]
WantedBy=multi-user.target #一条命令启动一个进程

[root@zbs-staging-api system]# systemctl start ncmulti@5733
[root@zbs-staging-api system]# systemctl start ncmulti@5734
[root@zbs-staging-api system]# systemctl start ncmulti@5732

[root@zbs-staging-api system]# ps aux | grep nc
root 19599 0.0 0.0 45676 2080 ? Ss 20:24 0:00 /usr/bin/nc -l 5735
root 19616 0.0 0.0 45676 2080 ? Ss 20:24 0:00 /usr/bin/nc -l 5733
root 19622 0.0 0.0 45676 2076 ? Ss 20:24 0:00 /usr/bin/nc -l 5734
root 19628 0.0 0.0 45676 2080 ? Ss 20:24 0:00 /usr/bin/nc -l 5732

#一条命令启动多个进程

[root@zbs-staging-api system]# systemctl start ncmulti@{9283,9282,9284} 或者 systemctl start ncmulti@{9282..9284}

[root@zbs-staging-api system]# ps aux | grep nc
root 0.0 0.0 45676 2076 ? Ss 20:26 0:00 /usr/bin/nc -l 9283
root 0.0 0.0 45676 2076 ? Ss 20:26 0:00 /usr/bin/nc -l 9282
root 0.0 0.0 45676 2076 ? Ss 20:26 0:00 /usr/bin/nc -l 9284

[root@zbs-staging-api system]# systemctl restart ncmulti@{9283,9282,9284} #批量重启
[root@zbs-staging-api system]# ps aux | grep nc
root 19959 0.0 0.0 45676 2080 ? Ss 20:27 0:00 /usr/bin/nc -l 9283
root 19962 0.0 0.0 45676 2076 ? Ss 20:27 0:00 /usr/bin/nc -l 9282
root 19963 0.0 0.0 45676 2076 ? Ss 20:27 0:00 /usr/bin/nc -l 9284

# 启动多进程传递有序参数

systemctl start storage@sd{b..m}

systemd管理服务的更多相关文章

  1. linux任务计划 chkconfig工具 systemd管理服务 unit介绍 target介绍

    linux任务计划 任务计划:特定时间备份数据,重启服务,shell脚本,单独的命令等等. 任务计划配置文件:cat /etc/crontab [root@centos7 ~]# cat /etc/c ...

  2. linux任务计划cron、chkconfig工具、systemd管理服务、unit和target介绍

    第8周第1次课(5月14日) 课程内容: 10.23 linux任务计划cron10.24 chkconfig工具10.25 systemd管理服务10.26 unit介绍10.27 target介绍 ...

  3. Linux centos7 linux任务计划cron、chkconfig工具、systemd管理服务、unit介绍、 target介绍

    一.linux任务计划cron crontab -u  -e -l -r 格式;分 时 日 月 周 user command 文件/var/spool/corn/username 分范围0-59,时范 ...

  4. [CoreOS 转载] CoreOS实践指南(七):Docker容器管理服务

    转载:http://www.csdn.net/article/2015-02-11/2823925 摘要:当Docker还名不见经传的时候,CoreOS创始人Alex就预见了这个项目的价值,并将其做为 ...

  5. systemd 编写服务管理脚本

    我们运行 linux 服务器的主要目的是通过运行程序提供服务,比如 mysql.web server等.因此管理 linux 服务器主要工作就是配置并管理上面运行的各种服务程序.在 linux 系统中 ...

  6. systemd 编写服务管理脚本---学习

    转载:https://www.cnblogs.com/sparkdev/p/8521812.html 我们运行 linux 服务器的主要目的是通过运行程序提供服务,比如 mysql.web serve ...

  7. [转贴]systemd 编写服务管理脚本

    [转贴]sparkdev大神的博客, 关于 systemd的配置文件的 介绍, 自己之前二进制安装 k8s 时 超过一个 service文件 但是当时不明不白的. 现在再学习一下大神的文章 的确牛B ...

  8. Linux 使用 Systemd 管理进程服务

    转载自:https://mp.weixin.qq.com/s/e-_PUNolUm22-Uy_ZjpuEA systemd 介绍 systemd是目前Linux系统上主要的系统守护进程管理工具,由于i ...

  9. CentOs7下systemd管理知识要点

    centOs7的一个巨大的变动就是用systemd取代了原来的System V init.systemd是一个完整的软件包,安装完成后有很多物理文件组成,大致分布为,配置文件位于/etc/system ...

随机推荐

  1. CF1082解题报告

    CF1082A Vasya and Book 模拟一下即可 \(Code\ Below:\) #include <bits/stdc++.h> using namespace std; c ...

  2. Angular2入门体验

    好的工具往往使得开发应用更快更简单,而不是任何模块都手动开发.angualr cli就是一个支持 创建工程,添加文件,对各种任务如测试.打包.部署等迭代. 本文的目的就是基于TypeScript开发构 ...

  3. 跟着刚哥学习Spring框架--AOP(五)

    AOP AOP(Aspect Oriented Programming),即面向切面编程,可以说是OOP(Object Oriented Programming,面向对象编程)的补充和完善.OOP引入 ...

  4. Spring Cloud断路器Hystrix

    在微服务架构中,存在着那么多的服务单元,若一个单元出现故障,就会因依赖关系形成故障蔓延,最终导致整个系统的瘫痪,这样的架构相较传统架构就更加的不稳定.为了解决这样的问题,因此产生了断路器模式. 什么是 ...

  5. JS获取浏览器URL中查询字符串的参数

    首先要知道Location这个对象以及这个对象中的一些属性: href:设置或返回完整的url.如本博客首页返回http://www.cnblogs.com/wymninja/ host:设置或返回主 ...

  6. flask框架--模板

    今天又是一个精彩又无聊的一天,不过随着知识的缓慢的增加我的内心也充满了干劲,虽然前进的有些缓慢 但我不会这么容易放弃的,一定要相信自己,不要灰心 好了 ~ 不说废话了 , 我自己听的都有些受不了了 . ...

  7. Vim实用技巧系列 - tab和空格的转换

    有时候,我们会修改一些代码,而这些代码中的tab设定和我们自己的设定不一样.例如,我们自己的设定是以两个空格来代替tab,而要修改的代码则是使用tab.那么,我们应该怎样快速的将又有的tab转换为空格 ...

  8. ecshop 安装出错gd_version

    678: static function gd_version()

  9. 轻量级web富文本框——wangEditor使用手册(2)——扩展一个“缩进”功能 demo

    最新版wangEditor: 配置说明:http://www.wangeditor.com/doc.html demo演示:http://www.wangeditor.com/wangEditor/d ...

  10. Async异步编程入门示例

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...