Mar 23

Linux:非特权用户使用crontab实现开机任务 不指定

felix021 @ 2012-3-23 15:51 [IT » 操作系统] 评论(0) , 引用(0) , 阅读(5840) | Via 本站原创 | |
以前一直纳闷,非特权用户不能编辑 /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 啦!



欢迎扫码关注:




转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   *非必须
网址   电邮   [注册]