OVH Community, votre nouvel espace communautaire.

Cron ligne de commande php


astro
27/07/2004, 10h31
J'ai le même problème et apparement aucune solution n'a été posté sur ce forum.

Mon cron fonctionne, le script s'execute quand je fais "executer maintenant" mais la sortie de commande semble déconner.

J'ai installé la release 1.50 et le problème persiste.

[VYS]
19/02/2004, 12h32
J'ai l'habitude d'utiliser des scripts php exécutés en cron du genre :
php /home/myhome/www/MH_Auto/Auto_MakeCalendar.php

Malheureusement, sur mon superplan, celà ne semble pas fonctionner et j'obtient le message cabalistique suivant
Output from command php /home/myhome/www/MH_Auto/Auto_MakeCalendar.php ..

Content-type: text/html
X-Powered-By: PHP/4.3.4

# exec_cron.cgi
# Execute an existing cron job, and display the output

require './cron-lib.pl';
&ReadParse();

@jobs = &list_cron_jobs();
$job = $jobs[$in{'idx'}];
&can_edit_user(\%access, $job->{'user'}) || &error($text{'exec_ecannot'});
&foreign_require("proc", "proc-lib.pl");

# split command into command and input
$job->{'command'} =~ s/\\%/\0/g;
@lines = split(/%/ , $job->{'command'});
foreach (@lines) { s/\0/%/g; }
for($i=1; $i<@lines; $i++) {
$input .= $lines[$i]."\n";
}

$| = 1;
$theme_no_table++;
&header($text{'exec_title'}, "");
print "
\n";
&additional_log('exec', undef, $lines[0]);
&webmin_log("exec", "cron", $job->{'user'}, $job);

# Remove variables that wouldn't be in the 'real' cron
foreach $e ('SERVER_PORT', 'GATEWAY_INTERFACE', 'WEBMIN_VAR', 'SERVER_ROOT',
'REMOTE_USER', 'SERVER_ADMIN', 'REQUEST_METHOD', 'REMOTE_HOST',
'REMOTE_ADDR', 'SERVER_SOFTWARE', 'PATH_TRANSLATED', 'QUERY_STRING',
'MINISERV_CONFIG', 'SERVER_NAME', 'SERVER_PROTOCOL', 'REQUEST_URI',
'DOCUMENT_ROOT', 'WEBMIN_CONFIG', 'SESSION_ID', 'PATH_INFO',
'BASE_REMOTE_USER') {
delete($ENV{$e});
}
foreach $e (keys %ENV) {
delete($ENV{$e}) if ($e =~ /^HTTP_/);
}

# Set cron environment variables
foreach $e (&read_envs($job->{'user'})) {
$ENV{$1} = $2 if ($e =~ /^(\S+)\s+(.*)$/);
}

# Get command and switch uid/gid
@uinfo = getpwnam($job->{'user'});
$ENV{"HOME"} = $uinfo[7];
$ENV{"SHELL"} = "/bin/sh";
$ENV{"LOGNAME"} = $ENV{"USER"} = $job->{'user'};
$( = $uinfo[3];
$) = "$uinfo[3] $uinfo[3]";
($>, $<) = ($uinfo[2], $uinfo[2]);

# Execute cron command and display output..
print &text('exec_cmd', "$lines[0]"),"

\n";
print "

";
$got = &foreign_call("proc", "safe_process_exec",
$lines[0], 0, 0, STDOUT, $input, 1);
print "$text{'exec_none'}\n" if (!$got);
print "
\n";

print "
\n";
&footer("edit_cron.cgi?idx=$in{'idx'}", $text{'edit_return'},
"", $text{'index_return'});
Auriez-vous une idée de la provenance de ce message ? Est-ce ma méthode d'appel qui est incorrecte ?

merci d'avance