Current time: 05-05-2024, 07:59 PM Hello There, Guest! (LoginRegister)


Post Reply 
Writing CronJobs Web int. It's time!
Author Message
data-stream_ru Offline
Moderator
*****
Moderators

Posts: 471
Joined: Jan 2009
Reputation: 7
Post: #11
RE: Writing CronJobs Web int. It's time!
Yyyps! My Coder are sleeping (may be so lot of Deutsch Schnaps? or Bavarian beer?).
In this reason, I add litle change to hcrond myself.

Let's go.
Open main.c in pakcage hcrond-0.3.2 and do litle change

struct Jobs {
int id;
int lastrun, nextrun;
char *sec, *min, *hour, *day, *mon, *dow;
int andor;
int uid, gid, nic;
char *cmd, *name;
int runonce;
int activ; /* <--- ADD THIS */
Jobs *n;
};

after
nw->runonce = atoi(row[15]);
Adding
nw->activ = atoi(row[16]);

And change
if ((tm >= s->nextrun) && (s->lastrun != tm))
To
if ((tm >= s->nextrun) && (s->lastrun != tm) && (s->activ == 1))

Copmpile pacage with option -pedantic
At this point we heave a support column "activ". If it's != 1 Job is ignored.
I tested it and that seens worked.

BUT! For a future development we must remember, that we can't change structure of columns N 0-16 , becouse it used in compiled daemon! Only columns after N16 we can use and change for aour php development!

I use this table structure for my development at this time
Code:
CREATE TABLE IF NOT EXISTS `hcrondtab` (
  `id` int(11) NOT NULL auto_increment,
  `sec` varchar(128) collate utf8_unicode_ci default '0',
  `min` varchar(128) collate utf8_unicode_ci default '*',
  `hour` varchar(128) collate utf8_unicode_ci default '*',
  `day` varchar(128) collate utf8_unicode_ci default '*',
  `mon` varchar(128) collate utf8_unicode_ci default '*',
  `dow` varchar(128) collate utf8_unicode_ci default '*',
  `uid` varchar(128) collate utf8_unicode_ci default NULL,
  `gid` varchar(128) collate utf8_unicode_ci default NULL,
  `machine` varchar(128) collate utf8_unicode_ci default NULL,
  `cmd` varchar(512) collate utf8_unicode_ci NOT NULL,
  `name` varchar(128) collate utf8_unicode_ci NOT NULL,
  `andor` enum('&','|') collate utf8_unicode_ci NOT NULL default '|',
  `nice` int(11) default '0',
  `lastrun` int(11) default '0',
  `runonce` int(11) NOT NULL default '-1',
  `activ` int(1) default '1',
  `coment` varchar(255) character set utf8 default NULL,
  `domain` int(10) NOT NULL,
  `alias` int(10) NOT NULL,
  `subdomain` int(10) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;

And columns named "alias" and "subdomain" reserved for future. Becouse we can't support corectly control for jobs in deleted subdomains and aliases at this time.
And an THERY important point to development we have with "Job anactiv" option!
If we simply changing "activ" status of something Job (in Web interface) the daemon see at the "lastrun" that they lost many points of job must runing. And then they runing job so often, but lost time (how long the job has been disabled and how much is lost launches). These launches may cause unnecessary overloading the server Sad

We must remember, that Every time we change the status of a job with the "inactive" to "activele" we must put in the column "lastrun" the current time!

Is it time to rewrite our betta Web Interface under hcrond?

2 Forum's moderators
Mey be your move back this topic to "Discussion"?
And after the end of development, I can write a new "howto", very simple, with all attached gzip files. Without Russian vodka Wink
I think we should share the creative process of the outcome, isn't it?
(This post was last modified: 01-08-2009 08:51 AM by data-stream_ru.)
01-08-2009 08:16 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Writing CronJobs Web int. It's time! - data-stream_ru - 01-08-2009 08:16 AM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)