Cronjob is based on the system time or its own time elapse? If it is system time, when I change the system time manually, will cronjob follow the new set up time accordingly?
cron uses the system clock, which it checks every minute. For changes to the system clock, the following extract from the
man page might be useful:
Special considerations exist when the clock is changed by less than 3 hours, for example at the beginning and end of daylight savings time. If the time has moved forwards, those jobs which would have run in the time that was skipped will be run soon after the change. Conversely, if the time has moved backwards by less than 3 hours, those jobs that fall into the repeated time will not be re-run.
If you move your clock from e.g. 12:04 to 12:06 and you have jobs scheduled for 12:05, these will not run.
If you have to run a job at 12:05 each day or at the earliest opportunity after that (after a power up, or system clock), then run that job every minute (or with a longer interval if that is acceptable) and have its script check if it was last run for this day based on some status file. If that status file is there and up to date, the script should exit immediately (i.e. it ran at 12:05 or the earliest opportunity it had after that to run). If not, set the status file and run the rest of the script, so any further invocations won't do anything until the clock reaches 12:05 the next day.
Especially if the job takes longer, it is important to update the status file first and then continue running, otherwise the 12:06 check will not find an updated status and start running another job in parallel.