一、在/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

 

相关文章:

  • 2021-12-15
  • 2021-11-11
  • 2021-06-14
  • 2022-12-23
  • 2021-08-26
  • 2021-12-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2018-03-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2021-06-09
相关资源
相似解决方案