原稿地址:
http://www.jinbuguo.com/systemd/systemd.service.html
示例:
LINUX创建systemd自启动服务
[PHPutf@localhost ~]$ ls /etc/rc.local-l
-rwxr-xr-x 1 root root 52 1月 30 14:11 /etc/rc.local
[PHPutf@localhost~]$ cat /etc/rc.local
#!/bin/bash
echo 0 >/proc/sys/vm/vfs_cache_pressure
[PHPutf@localhost~]$ ls /etc/systemd/system/rc.local.service-l -rw-r--r-- 1 root root 138 1月 30 14:09 /etc/systemd/system/rc.local.service [PHPutf@localhost ~]$ cat /etc/systemd/system/rc.local.service [Unit] Description=/etc/rc.local [Service] Type=oneshot RemainAfterExit=yes ExecStart=/etc/rc.local [Install] WantedBy=multi-user.target