diff --git a/ulib/crontab b/ulib/crontab index 13a93ae..fb43c47 100644 --- a/ulib/crontab +++ b/ulib/crontab @@ -130,6 +130,7 @@ function ctmatch(ctval, ref, parts, part, i, j, start, end, step, o end = start } # tester si ça matche + #print "start=" start ", end=" end ", step=" step", ref=" ref #DEBUG for (j = start; j <= end; j += step) { if (j == ref) { ok = 1 @@ -146,11 +147,12 @@ BEGIN { ctref = refM " " refH " " refdom " " refmon " " refdow print "##now: " ctref - matches = 0 + match_ctline = 0 + match_indented = 0 } /^(export[ \t]+)?[a-zA-Z_][a-zA-Z0-9_]*[-+%#]=/ { - # manipulation de variables PATH + # manipulation de variables de type PATH match($0, /^(export[ \t]+)?([a-zA-Z_][a-zA-Z0-9_]*)([-+%#])=(.*)$/, parts) name = parts[2] type = parts[3] @@ -182,6 +184,7 @@ BEGIN { M = $1; H = $2; dom = $3; mon = $4; dow = $5 sub(/^[ ]*[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]*/, "", $0) + if (!match_ctline) match_indented = 0 ctline = M " " H " " dom " " mon " " dow gsub(/\*/, "0-59", M) @@ -201,12 +204,21 @@ BEGIN { if (Mok && Hok && monok && (domok || dowok)) { print "##matches: " ctline - matches = 1 + match_ctline = 1 + match_indented = 1 } - if (matches && $0 != "") { + if (match_ctline && $0 != "") { + print "__ctexec " quote_value($0) + match_ctline = 0 + } + next +} +/^[ \t]+/ { + if (match_indented) { + # il faut matcher les commandes indentees + sub(/^[ \t]+/, "", $0) print "__ctexec " quote_value($0) - matches = 0 } next } diff --git a/uscrontab b/uscrontab index b681340..885b837 100755 --- a/uscrontab +++ b/uscrontab @@ -75,12 +75,27 @@ Les lignes commençant par # sont des commentaires et sont ignorées Certaines extensions par rapport à la syntaxe de crontab sont autorisées. Il est en particulier possible de spécifier plusieurs planifications pour une - seule commande. Par exemple, la ligne suivante permet d'exécuter 'command' - toutes les heures ET à 1h05: + seule commande. Par exemple, les lignes suivantes permettent d'exécuter + 'command' toutes les heures ET à 1h05: 0 * * * * 5 1 * * * command + Il est aussi possible d'utiliser la même planification pour plusieurs + commandes sans devoir répéter la définition de la planification. Les lignes + suivantes planifient command1 et command2 toutes les heures: + + 0 * * * * command1 + command2 + + Pour être prise en compte, la ligne command2 doit commencer par au moins un + espace ou une tabulation. Pour la lisibilité, la syntaxe suivante est + supportée aussi: + + 0 * * * * + command1 + command2 + == Fonctions disponibles == La fonction check_pidfile() est disponible, et permet de vérifier qu'une