Mar 23
以前一直纳闷,非特权用户不能编辑 /etc/rc.local ,应该如何实现开机启动任务的功能。。

刚刚详读了下 man 5 crontab ,才知道crontab的前五个参数除了可以用分时日月周之外,

还可以用一些预定义的类型(叫做Vixie cron),其中一个特殊的就是 @reboot :
引用
Instead of the first five fields, one of eight special strings may appear:

              string        meaning
              ------        -------
              @reboot        Run once, at startup.
              @yearly        Run once a year, "0 0 1 1 *".
              ......

也就是说,只要运行crontab -e,加入一行

@reboot /home/username/my_rc.local

就可以实现个人用户的 rc.local 啦!
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]