Or if you don't have another server where you can set a cron job, and if you
don't need the program to run exactly  at a certain interval, you can
activate your program each time someone visits your front page.

Then you could modify the program to be really activated only after an hour,
24 hours, etc.
I use this method and works fine but ... you need to have some visitors on
the page.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Sven Bentlage" <[EMAIL PROTECTED]>; "[EMAIL PROTECTED]
[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Sent: Thursday, December 12, 2002 5:22 PM
Subject: RE: cronjob via perl


You could setup the script to run through CGI and then use cron on another
box to curl, lynx, LWP, etc. the script at your intervals. This is obviously
less secure, but you could do things like require a password, check the IP
of the machine doing the call (though this can be spoofed as well, just less
easily), etc.

http://danconia.org

------------------------------------------------
On Thu, 12 Dec 2002 15:31:53 +0100, Sven Bentlage <[EMAIL PROTECTED]>
wrote:

> My provider doesn`t allow any user cronjobs, but I have to perform a
> regular task (set back passwords ).
> So I just wrote a small script to the job for me, but I am not sure if
> it will need to much resources (and because of this would be killed by
> my provider)
>
> Does anyone know a better solution than continuously running a perl
> script?
>
> Thanks for your help in advance.
>
> Sven
>
> #!/bin/perl -w
> BEGIN {
> $| = 1;
> push(@INC,'/htdocs/www/cgi-bin/lib');
> use DBI;
> }
>
>
> #Version 0.1
>
>
>
>
>
> my $date = localtime(time);
> my $dsn = '';   # Data Source Name
> my $db_user = ''; # Database User
> my $db_pass = ''; # database pass
> my $logfile = "cron_log.txt"; # Logfile
>
>
> open (LOG, ">>$logfile") || mydie($_);
>
> &pw_switch();
>
> sub pw_switch {
>
> sleep(8*60*60);
> my $new_password = pw_create();
> my $dbh = DBI->connect( $dsn, $db_user, $db_pass) ||
> mydie($DBI::errstr);
>   #my $number = $dbh->do("select count(*) from memberscopy where
>   my $del_pw = $dbh ->do( $sql ) || mydie($DBI::errstr);
>   print LOG " $date -- $sql\n";
>
> $dbh->disconnect;
> close (LOG);
> print qq ~
> <html>
> <head>
> <title>Password switching done</title>
> </head>
> <body bgcolor=red>
> <h1>Password switched</h1>
> </body>
> </html>
> ~;
>
>
> }
>
> sub pw_create {
> my $password = join '', ("1".."9","a".."z","A".."Z",0..9)[map {rand
> 36} 0..9];
> $password = substr($password, 0, 8);
>
>
> chomp $password;
> return ($password);
> }
>
>
>
> sub mydie {
>   open (LG, ">>.Mydie_cron.txt");
>   print LG "$_  -- $date \n";
>   close (LG);
>   exit;
> }
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to