
我想在電腦啟動時以 root 身份運行腳本。這是早些時候在 rc.local 中完成的,但現在不再了。
我嘗試過的:
- 將腳本放入
/etc/profile.d
- 添加
/pathto/script.sh
在/etc/profile
- 添加
/pathto/script.sh &
到/etc/xdg/openbox/autostart
該腳本用於設定 powertop 推薦的內容;當我運行時,腳本工作得很好sudo /pathto/script.sh
。
答案1
你可以把它放在你的 crontab 中
@reboot /pathto/script.sh