原稿地址:
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