vern@2016-03-16:/usr% ls tags
crontab

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

One approach is to add an @reboot cron task:

  1. Running crontab -e will allow you to edit your cron.

  2. 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;
	}