学习
实践
活动
工具
TVP
写文章

linux:根据主进程查找子进程

但是通过systemctl show --property MainPID <service name> 命令只能获取最左边的父进程ID. 怎么样通过这个MainPID获取实际工作的子进程ID呢,ps的 -g选项可以根据PID过程要显示的所有属于指定PID的进程及子进程,比如: $ ps --forest -o pid,cmd -g 1088 /bin/bash # 获取服务的MainPID,$service_name 为服务名称 main_pid="$(systemctl show $service_name --property=MainPID

2.1K20

Redis设置开机自启动

ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 重载服务 # 重载服务

23220
  • 广告
    关闭

    热门业务场景教学

    个人网站、项目部署、开发环境、游戏服务器、图床、渲染训练等免费搭建教程,多款云服务器20元起。

  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    Redis设置开机启动

    ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 重载服务 # 重载服务

    52820

    CentOS7下PHP&Nginx&Mysql编译安装及sytemd配置

    sbin/php-fpm --nodaemonize --fpm-config /data/soft/php/etc/php-fpm.conf ExecReload=/bin/kill -USR2 $MAINPID ExecStart=/data/soft/nginx/sbin/nginx -c /data/soft/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target Mysql的systemd mysqld_safe --defaults-file=/data/soft/mysql/my.cnf --ledir=/data/soft/mysql/bin ExecStop=kill -s -QUIT $MAINPID

    30830

    Centos7安装redis

    ExecStart=/usr/local/redis/src/redis-server /usr/local/redis/etc/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 6.x [Unit] usr/local/redis-6.2.4/src/redis-server /usr/local/redis-6.2.4/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target Docker安装Redis

    1.3K20

    zabbix编译安装时的systemctl启动管理

    local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf ExecStop=/usr/bin/kill $MAINPID local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf ExecStop=/usr/bin/kill $MAINPID

    33420

    systemctl控制服务配置

    home/ec2-user/root #程序工作目录 ExecStart=/home/ec2-user/root/server #程序启动命令 ExecReload=/bin/kill -s -HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID KillMode=process Restart=on-failure RestartSec=20s [Install] WantedBy

    34610

    Redis 使用详解

    ExecStart=/REDIS_PATH/redis-3.2.0/src/redis-server /usr/local/redis/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 相关链接

    36460

    Cent OS安装Redis

    redis_6379.pid ExecStart=/usr/local/redis/bin/redis-server /etc/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID [Install] WantedBy=multi-user.target systemctl enable redis systemctl

    13020

    CentOS7安装Redis最新版

    bin/redis-server /usr/local/redis/conf/redis.conf --supervised systemd ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -S QUIT $MAINPID Type=notify User=redis Group=redis RuntimeDirectory=redis RuntimeDirectoryMode

    4710

    2019-03-27 CentOS7 Tengine 设置系统自动启动

    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 4、修改文件权限

    36140

    使用systemctl管理tomcat多实例原创

    usr/local/tomcat/tomcat.pid ExecStart=/usr/local/tomcat/bin/startup.sh ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target EOF 注意:Environment local/tomcat_app/tomcat.pid ExecStart=/usr/local/tomcat_app/bin/startup.sh ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 最后验证一下。

    8420

    Redis 学习笔记 2.2.1 Redis配置成系统服务(CentOS7)

    /tools/redis-5.0.4/src/redis-server /root/tools/redis-5.0.4/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 重载系统服务 sudo

    13220

    tomcat-8.0.36 一键安装脚本(centos-7.3.1611)

    Type=forking PIDFile=${DSR}/tomcat.pid ExecStart=${DSR}/bin/startup.sh ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target eof

    51340

    Centos8上安装Redis5.X

    pid ExecStart=/opt/redis5/bin/redis-server /opt/redis5/conf/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target   重载系统服务:systemctl

    23220

    CentOS7将Nginx添加系统服务的方法步骤

    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target 添加完成后再来看下

    74331

    CentOS 编译安装 Nginx 隐藏 Header Server 标记

    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target 相关设置,一定要执行,否则可能出现重启后无法自启动 mkdir

    32900

    deepin uos 是否开源_deepin docker

    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target # 重新加载服务文件

    6920

    centos7使用nginx+uwsgi部署python django项目

    usr/local/bin/uwsgi --ini /home/dengzhixu/crawl_data/uwsgi.ini #ExecStop=/usr/local/bin/uwsgi --stop $MAINPID #ExecReload=/usr/local/bin/uwsgi -d --reload $MAINPID # Requires systemd version 211 or newer #RuntimeDirectory

    6310

    扫码关注腾讯云开发者

    领取腾讯云代金券