Skip to content

MahdiyDev/cron-jobs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cron Jobs scheduler

install command

make install

Cron jobs overview.

Usege of CronTime:

CronTime time;

time.SetMinutes(10) // sets by minutes

time.GetSeconds() // return converts to seconds

Units of CronTime:

  • weak
  • day
  • hour
  • minute
  • second

Single usege of cron job:

CronTime time;

time.SetMinutes(10) 

cron::cronjob single_cron(
	time,
	[](void) {
		std::cout << "cron executed" << std::endl;
	});

// your code...

single_cron.wait();

The wait function waits for cron to shut down.

Usege of cron jobs scheduler:

cron::schedule::schedule sch;

CronTime time;

time.SetMinutes(10) 

sch.add(
    time,
    [](void) {
        std::cout << "schedule executed" << std::endl;
    });

// your code...

sch.wait();

Alawys use lambda function.