
我想在啟動後運行一個簡單的命令。
cd /mypath
# then
./mycommand
我該怎麼做?
答案1
兩種解決方案:
第一個是將命令的完整路徑放入/etc/rc.local
:
/mypath/mycommand
或者,cron 方式:
crontab -e
@reboot cd /mypath;./mycommand
來自 crontab 手冊:
@reboot Run once, at startup.
我想在啟動後運行一個簡單的命令。
cd /mypath
# then
./mycommand
我該怎麼做?
兩種解決方案:
第一個是將命令的完整路徑放入/etc/rc.local
:
/mypath/mycommand
或者,cron 方式:
crontab -e
@reboot cd /mypath;./mycommand
來自 crontab 手冊:
@reboot Run once, at startup.