ubuntu制作为镜像boot.service自启动

阅读 127

2022-12-07


1、创建boot.service,并将其push到此路径下。

/etc/systemd/system/boot.service

[Unit]
Description=boot Application Servie
Requires=network.target
DefaultDependencies=no

[Service]
Type=oneshot
ExecStart=/work/boot.sh
RemainAfterExit=true
Restart=on-failure

[Install]
WantedBy=multi-user.target

2、创建软连接

ln -s /etc/systemd/system/boot.service /etc/systemd/system/multi-user.target.wants/boot.service

3、打包ubuntu镜像,烧录后,开机即启动了boot.service里面的可执行程序。

精彩评论(0)

0 0 举报