编写systemd下服务脚本

it2022-05-09  24

编写systemd下服务脚本

一、在/lib/systemd/system目录下建立服务脚本

sshd.service 必须以service结尾

二、填写内容

[Unit]

Description=SSH Key Generation

 

[Service]

Type=oneshot

RemainAfterExit=yes

 

ExecStart=/etc/init.d/sshd  start

 

[Install]

WantedBy=multi-user.target

 

三、根据脚本后面的WantedBy=multi-user.target

在对于路径建立链接

Cd   /etc/systemd/system/multi-user.target.wants

Ln -s  /etc/systemd/system/multi-user.target.wants/sshd.service   sshd.service

 

转载于:https://www.cnblogs.com/liushuhe1990/p/9609019.html

相关资源:DirectX修复工具V4.0增强版

最新回复(0)