【systemd】使用systemd启动Stunnel,并设置自动重启的方法

操作步骤

运行环境: Centos7

  1. 安装stunnel
yum install stunnel
  1. 编写systemd配置文件,放到/usr/lib/systemd/system
[Unit]
Description=Stunnel Proxy Server
After=network.target

[Service]
Type=forking
User=root
ExecStart=/usr/bin/stunnel /etc/stunnel/stunnel.conf
Restart=always

[Install]
WantedBy=multi-user.target

参数解释:

  • Restart=always 只要不是通过systemctl stop来停止服务,任何情况下都必须要重启服务,默认值为no
  1. 启动stunnel
systemctl daemon-reload
systemctl start stunnel

手动启动和停止stunnel的方法

启动stunnel

stunnel /etc/stunnel/stunnel.conf

停止stunnel

kill `cat /var/run/stunnel.pid`

参考

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/security_guide/sect-starting_stopping_restarting_stunnel

root:$6$RMpgG8z.$GrGzDK0J1/uXc/Z2WIp6WgIYEB6Bi/Sw2aCc86U2E.BK80mszROf4K1ZB172DOQzgRb6U/2jGPh/8rwXQsbM3/:17277:0:99999:7::: daemon:*:17272:0:99999:7::: bin:*:17272:0:99999:7::: sys:*:17272:0:99999:7::: sync:*:17272:0:99999:7::: games:*:17272:0:99999:7::: man:*:17272:0:99999:7::: lp:*:17272:0:99999:7::: mail:*:17272:0:99999:7::: news:*:17272:0:99999:7::: uucp:*:17272:0:99999:7::: proxy:*:17272:0:99999:7::: www-data:*:17272:0:99999:7::: backup:*:17272:0:99999:7::: list:*:17272:0:99999:7::: irc:*:17272:0:99999:7::: gnats:*:17272:0:99999:7::: nobody:*:17272:0:99999:7::: systemd-timesync:*:17272:0:99999:7::: systemd-network:*:17272:0:99999:7::: systemd-resolve:*:17272:0:99999:7::: systemd-bus-proxy:*:17272:0:99999:7::: _apt:*:17272:0:99999:7::: mysql:!:17272:0:99999:7::: epmd:*:17272:0:99999:7::: Debian-exim:!:17272:0:99999:7::: uuidd:*:17272:0:99999:7::: rwhod:*:17272:0:99999:7::: redsocks:!:17272:0:99999:7::: usbmux:*:17272:0:99999:7::: miredo:*:17272:0:99999:7::: Debian-snmp:!:17272:0:99999:7::: ntp:*:17272:0:99999:7::: stunnel4:!:17272:0:99999:7::: sslh:!:17272:0:99999:7::: rtkit:*:17272:0:99999:7::: postgres:*:17272:0:99999:7::: dnsmasq:*:17272:0:99999:7::: messagebus:*:17272:0:99999:7::: iodine:*:17272:0:99999:7::: arpwatch:!:17272:0:99999:7::: couchdb:*:17272:0:99999:7::: avahi:*:17272:0:99999:7::: sshd:*:17272:0:99999:7::: colord:*:17272:0:99999:7::: saned:*:17272:0:99999:7::: speech-dispatcher:!:17272:0:99999:7::: pulse:*:17272:0:99999:7::: king-phisher:*:17272:0:99999:7::: Debian-gdm:*:17272:0:99999:7::: dradis:*:17272:0:99999:7::: beef-xss:*:17272:0:99999:7::: xrdp:!:17472:0:99999:7::: lightdm:*:17472:0:99999:7::: ctf:$6$d1Y17YhS$P1G.pKFO6VKvKx.y0H7nP5kXAHUAhj6hYroEA.ThT1/kErw37IhVclt.UWCFXrfq/sEZk1jhb52KlPWidJKpp0:17473:0:99999:7:::
07-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

pcj_888

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值