-
切换到目录/lib/systemd/system,创建一个aatest.service。
-
Root权限下编辑该service文件:黄色为要启动的bash脚本路径,完成后保存。
[Unit] Description=aatest [Service] ExecStart=/bin/bash /home/nvidia/mttcantest Type=oneshot #Restart=on-failure [Install] WantedBy=multi-user.target
-
设置服务自动启动,期间需要输入密码。
systemctl enable aatest.service
设置成功时,会自动创建符号链接,如上图。
-
如需禁用自动启动,输入以下命令:
systemctl disable aatest.service
切换到/etc/systemd/system/multi-user.target.wants 目录下查看相关服务链接是否删除。删除即成功。
-
reboot重新启动系统,服务生效。
版权声明:本文为qq_38212787原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。