What is the use of cron job server?

Ok, I’m thinking of creating a website that depends on cronjob.
I wonder if it can ever damage the server for the number of crontabs?

will say that I have 50 crontabs that need to be done every day, can this damage the server? if not, then the maximum number of crontabs should be added to the Linux server @ 512 MB of memory

+4
source share
1 answer

When you create a new task, the cron calls the job_add ( job.c ) function, this function allocates memory to the task and adds it to the tail of the task list. Work is distributed on the heap, so theoretically you are limited only by the RAM installed on your computer.

Some notes from the CRON code:

Task structure:

 typedef struct _job { struct _job *next; entry *e; user *u; } job; 

Each crontab user entry is identified by:

 typedef struct _entry { struct _entry *next; uid_t uid; gid_t gid; char **envp; char *cmd; bitstr_t bit_decl(minute, MINUTE_COUNT); bitstr_t bit_decl(hour, HOUR_COUNT); bitstr_t bit_decl(dom, DOM_COUNT); bitstr_t bit_decl(month, MONTH_COUNT); bitstr_t bit_decl(dow, DOW_COUNT); int flags; #define DOM_STAR 0x01 #define DOW_STAR 0x02 #define WHEN_REBOOT 0x04 } entry; 

And user structure:

 typedef struct _user { struct _user *next, *prev; /* links */ char *name; time_t mtime; /* last modtime of crontab */ entry *crontab; /* this person crontab */ } user; 

You can see that these structures do not require much memory. If you're curious about how the cron implementation works, you can see the code here: cron ubuntu source .

+1
source

Source: https://habr.com/ru/post/1432170/


All Articles