Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
package PerlSvc; # CollapsedSubs: RDD_Crontab EXE_CronTask $Name = 'S-Cron Daemon'; $DisplayName = 'Sinapse Cron Module Service'; sub Startup { while(ContinueRun()) { &main::STR_CronD; sleep(1); } } sub Install { print "Installing Sinapse Cron Module service\n"; print "\nNote : Please verify the correct sintax in your cront +ab\n"; } sub Remove { print "Removing Sinapse Cron Module service\n"; } sub Help { print "Help About Installation of Sinapse Cron Module service\ +n"; print "\nFor normal instalation of this service, please type:\ +n"; print " cronsvc -install\n"; print "For normal installation of the service whit auto startu +p, please type :\n"; print " cronsvc -install auto\n"; print "For more reference please consult with Sinapse Media Gr +oup\n"; } package main; use Time::localtime; my %dias = ( 1 => "Lu", 2 => "Ma", 3 => "Mi", 4 => "Ju", 5 => "Vi", 6 => "Sa", 7 => "Do" ); my %dias_crontab = ( 1 => "Lu", 2 => "Ma", 3 => "Mi", 4 => "Ju", 5 => "Vi", 6 => "Sa", 0 => "Do" ); sub STR_CronD { if(localtime->sec() eq 0){ my(@cront)=&main::RDD_Crontab(); foreach (@cront){ chomp($_); my($minu, $hora, $din, $mes, $dia, $ejecuta)=s +plit(/ /, $_,6); if($dia eq "*"){ if($mes eq "*"){ if($din eq "*"){ if($hora eq "*"){ my(@minut)=spl +it(/\,/, $minu); foreach(@minut +){ if($_ +eq localtime->min()){ + &main::EXE_CronTask($ejecuta); } } }else{ my(@horat)=spl +it(/\,/, $hora); foreach(@horat +){ if($_ +eq localtime->hour()){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } } } } }else{ my(@dint)=split(/\,/, +$din); foreach(@dint){ if($_ eq local +time->mday()){ if($ho +ra eq "*"){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } }else{ + my(@horat)=split(/\,/, $hora); + foreach(@horat){ + if($_ eq localtime->hour()){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } + } + } } } } } }else{ my(@mest)=split(/\,/, $mes); foreach(@mest){ if($_ eq (localtime->m +on()+1)){ if($din eq "*" +){ if($ho +ra eq "*"){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } }else{ + my(@horat)=split(/\,/, $hora); + foreach(@horat){ + if($_ eq localtime->hour()){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } + } + } } }else{ my(@di +nt)=split(/\,/, $din); foreac +h(@dint){ + if($_ eq localtime->mday()){ + if($hora eq "*"){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } + }else{ + my(@horat)=split(/\,/, $hora); + foreach(@horat){ + if($_ eq localtime->hour()){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask +($ejecuta); + } + } + } + } + } + } } } } } } }else{ my(@diat)=split(/\,/, $dia); foreach(@diat){ if($dias_crontab{$_} eq $dias{ +localtime->wday()}){ if($mes eq "*"){ if($din eq "*" +){ if($ho +ra eq "*"){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } }else{ + my(@horat)=split(/\,/, $hora); + foreach(@horat){ + if($_ eq localtime->hour()){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } + } + } } }else{ my(@di +nt)=split(/\,/, $din); foreac +h(@dint){ + if($_ eq localtime->mday()){ + if($hora eq "*"){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } + }else{ + my(@horat)=split(/\,/, $hora); + foreach(@horat){ + if($_ eq localtime->hour()){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask +($ejecuta); + } + } + } + } + } + } } } }else{ my(@mest)=spli +t(/\,/, $mes); foreach(@mest) +{ if($_ +eq (localtime->mon()+1)){ + if($din eq "*"){ + if($hora eq "*"){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask($ejecuta); + } + } + }else{ + my(@horat)=split(/\,/, $hora); + foreach(@horat){ + if($_ eq localtime->hour()){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask +($ejecuta); + } + } + } + } + } + }else{ + my(@dint)=split(/\,/, $din); + foreach(@dint){ + if($_ eq localtime->mday()){ + if($hora eq "*"){ + my(@minut)=split(/\,/, $minu); + foreach(@minut){ + if($_ eq localtime->min()){ + &main::EXE_CronTask +($ejecuta); + } + } + }else{ + my(@horat)=split(/\,/, $hora); + foreach(@horat){ + if($_ eq localtime->hour()) +{ + my(@minut)=split(/\ +,/, $minu); + foreach(@minut){ + if($_ eq lo +caltime->min()){ + &ma +in::EXE_CronTask($ejecuta); + } + } + } + } + } + } + } + } } } } } } } } } return(); } sub RDD_Crontab { my @cront1 = (); open (CRON, "< c:\\sinapse\\cfg\\crontab"); while (<CRON>){ chomp($_); push (@cront1, $_); } close(CRON); return(@cront1); } sub EXE_CronTask { my($action)=(@_); system($action); return(); } # Crontab indice # # MINUTE(0-59) HOUR(0-23) DAYOFMONTH(1-31) MONTHOFYEAR(1-12) + DAYOFWEEK(0-6) Note 0 = Sun # * * + * # ejp # 0 0 1 1 * task

In reply to Crond by zeroquo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (15)
    As of 2015-07-02 12:48 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (37 votes), past polls