我有这个 shell 命令 asebamedulla "ser:device=/dev/ttyACM0"
,我希望它在重新启动 Linux 后直接运行。
我阅读了一些解决方案( shell_command &
,或者作为守护进程在后台运行......)但我不知道如何使用它们。
我的问题是:
如何在启动后自动直接运行shell命令?
最佳答案
解决方案一:
>>sudo crontab -e
#In the first line of this file enter this:
@reboot <your command whatever>
#Save and Exit
解决方案 2:
将脚本命名为“whatever.sh”。
将文件放在您的/etc/init.d/ 目录中。
更改文件的权限。
chmod +x /etc/init.d/whatever.sh
关于linux - 重启后自动直接运行一个shell命令并保持运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50153623/