设定开机启动脚本的新方法

@ref: http://askubuntu.com/questions/814/how-to-run-scripts-on-start-up One approach is to add an @reboot cron task: Running crontab -e will allow you to edit your cron. Adding a line like this to it: @reboot /path/to/script will execute that script once your computer boots up. Run on actual reboot, rather than cron restart static void run_reboot_jobs(db) cron_db *db; { register user *u; register entry *e; int rbfd; #ifdef DEBIAN #define REBOOT_FILE "/var/run/crond.reboot" /* Run on actual reboot, rather than cron restart */ if (access(REBOOT_FILE, F_OK) == 0) { /* File exists, return */ log_it("CRON", getpid(),"INFO", "Skipping @reboot jobs -- not system startup"); return; }

2016-03-16 · wuan