1)cp /lib/systemd/system/rc-local.service /etc/systemd/system
2)修改/etc/systemd/system/rc-local.service,在该文件的最底部添加(可用vi /etc/systemd/system/rc-local.service命令)
[Install]
WantedBy=multi-user.target
Alias=rc-local.service
3)创建/etc/rc.lcoal文件(vi /etc/rc.lcoal)
#!/bin/sh
/usr/local/sbin/rtlfxled&
source /etc/profile 特别注意,java程序必须加,要不然报错
/hw/start.sh &
exit 0
4)执行 chmod -R 777 /etc/rc.local
5)执行systemctl start rc-local.service
systemctl enable test.service
参考:https://blog.csdn.net/ytusdc/article/details/127042924
https://blog.csdn.net/u014760706/article/details/125906316
标签:systemd,java,service,Ubuntu,etc,自启,rc,local From: https://www.cnblogs.com/liubaihui/p/17925998.html