Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cron

Status
Not open for further replies.

Zas

Programmer
Oct 4, 2002
211
US
I've been running cron from my computer, and have had it goto little perl scripts on the server every half hour, and redirect to the next script until they are all done. I could sum them up in one giant script if I needed too though.

But my question is, I'll be leaving soon and I need the server to start the scripts w/o my computer being on. It was cron capabilities, but I'm not sure exactly how to send it to the script I want on the server. Please help.

Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
I get this error:
/bin/sh: line 1: No such file or directory

and /bin/sh: line 1: run: command not found

when I try it on the server. help...

Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
Can we see the script and the cron entry?

ChrisP
RHCE, LPIC-1, CCNA, CNE, MCSE, +10 others
 
I was trying: and,
run for commands. Thanks


########## cturn.pl
open(CHAR, "user/databasen.txt");
$CHAR=<CHAR>;@CHARE = split /::/, $CHAR;close CHAR;


foreach $iitem (@CHARE) {
$lccname = lc($iitem);
open(TURN, &quot;user/$lccname/turn.txt&quot;);
$TURN=<TURN>;
@TURN = split /::/, $TURN;
close TURN;

foreach $line (@TURN) { ($oturn) = split(/::/, $line); }

if ($oturn < 250) {$nturn = $oturn + 2;} else {$nturn = 250;}
$uccname = ucfirst($lccname);
print &quot;<br>$uccname - $nturn&quot;;

$file = &quot;/usr/home/valuico/ deleteStuff();
open(NTUR, &quot;>/usr/home/valuico/ or die(&quot;Couldn't open file for writing!&quot;);
print NTUR &quot;$nturn\::&quot;;
close NTUR;

}

print&quot;
<META http-EQUIV=\&quot;Refresh\&quot; Content=\&quot;4; URL=http://valui.com/cgi-bin/compdel.pl\&quot;>
&quot;;


########

Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
I need to see the cron entry also. Do you have this at the top of your Perl scripts..

#!/usr/bin/perl

Without that command, cron won't know how to execute the script, unless you call it with perl specifically (perl script.pl).

ChrisP
RHCE, LPIC-1, CCNA, CNE, MCSE, +10 others
 
OK. The entire script is:
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
# Author name:
# Creation date:
#
# Description:
#


$rootdir = &quot;
$idata = $ENV{'REMOTE_ADDR'};
$pdata = $ENV{'HTTP_HOST'};


print &quot;Content-type:text/html\n\n&quot;;


print &quot;$rootdir&quot;;



open(CHAR, &quot;user/databasen.txt&quot;);
$CHAR=<CHAR>;@CHARE = split /::/, $CHAR;close CHAR;


foreach $iitem (@CHARE) {
$lccname = lc($iitem);
open(TURN, &quot;user/$lccname/turn.txt&quot;);
$TURN=<TURN>;
@TURN = split /::/, $TURN;
close TURN;

foreach $line (@TURN) { ($oturn) = split(/::/, $line); }

if ($oturn < 250) {$nturn = $oturn + 2;} else {$nturn = 250;}
$uccname = ucfirst($lccname);
print &quot;<br>$uccname - $nturn&quot;;

$file = &quot;/usr/home/valuico/ deleteStuff();
open(NTUR, &quot;>/usr/home/valuico/ or die(&quot;Couldn't open file for writing!&quot;);
print NTUR &quot;$nturn\::&quot;;
close NTUR;

}

print&quot;
<META http-EQUIV=\&quot;Refresh\&quot; Content=\&quot;4; URL=http://valui.com/cgi-bin/compdel.pl\&quot;>
&quot;;

sub deleteStuff { unlink($file) or &quot;Error deleting file ($file).txt\n&quot;; }
sub error {
print &quot;$_[0]&quot;;
exit;
}
################



Now how do I get the command and have cron run that script?

Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
Grrrr.. after a few days of researching and trying and nothing, I just decided to try something from another langauge. I stole the php one and converted it to perl.
0 6 * * * /usr/bin/lynx - source &quot; 1>/dev/null 2>&1


Thanks for time though.

Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top