10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use CGI qw/:cgi-lib/;
use CGI::Carp qw(fatalsToBrowser);
%FORM=Vars();
#Instructions
##################
#Set this to the server path to the crons.txt
$pathtocrontxt="/var/www/vhosts/mydomain/cgi-bin/crons.txt";
# In the crons.txt put the first line as 0 and then put each cronjob on a seperate line below
# set the chmod permissions to crons.txt to 777 and cron.cgi to 755
#####################################
print "Running Crons...\n";
open(INF,"$pathtocrontxt") or print "couldnt open file";
@commands=<INF>;
close(INF);
foreach $line(@commands){
chomp($line);
if($line == 0){
print "not working\n";
@commands[0]="1\n";
open(OUTF,">$pathtocrontxt");
foreach $command(@commands){
print OUTF "$command";
}
close(OUTF);
}
elsif($line == 1){
print "working";
exit;
}
else {
print "Executing: $line\n";
$output=system("$line");
print "$output\n";
}
}
@commands[0]="0\n";
open(OUTF,">$pathtocrontxt");
foreach $command(@commands){
print OUTF "$command";
}
close(OUTF);
print "\n\nDone!\n";
1
2
3
4
0
/usr/bin/php /var/www/vhosts/domain/httpdocs/do-it/index.php
/usr/bin/php /var/www/vhosts/domain/httpdocs/do-it1/index.php
/usr/bin/php /var/www/vhosts/domain/httpdocs/do-it2/index.php
open(OUTF,">$pathtocrontxt")
open(OUTF,">",$pathtocrontxt)
open(OUTF,">",$pathtocrontxt) or die $!;
/usr/bin/php /var/www/vhosts/domain/httpdocs/do-it/index.php
curl http://domain.com/do-it/index.php /dev/null
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw/:cgi-lib :standard/;
use CGI::Carp qw(fatalsToBrowser);
print header;
#Instructions
##################
#Set this to the server path to the crons.txt
my $pathtocrontxt="./cron.txt";
# In the crons.txt put the first line as 0 and then put each cronjob on a seperate line below
# set the chmod permissions to crons.txt to 777 and cron.cgi to 755
my @commands;
my $lines = 0;
#####################################
print "Running Crons...\n";
if( open my $inf,"<",$pathtocrontxt ){
@commands = <$inf>;
close $inf;
chomp @commands;
for my $line(@commands){
if( $lines == 0 && $commands[$lines] == 0 ){
print "not working\n";
$commands[0] = 1;
write_file();
}
elsif($lines == 0 && $commands[$lines] == 1){
print "working\n";
$commands[0] = 0;
write_file();
exit;
}
else {
print "Executing: $line\n";
my $output = system("$line");
print "$output\n";
}
$lines++;
}
$commands[0] = 0;
}
print "\n\nDone!\n";
sub write_file{
if( open my $out, '>', $pathtocrontxt ){
print $out $_,"\n" for @commands;
}
}
1
2
3
4
5
6
if(! system("$line") ) {
print "$line executed successfully!\n";
}
else {
print "Failed to execute $line, Exitcode: " . $? >> 8;
}
10 Einträge, 1 Seite |