Hi sven (et al)
        Wiggins(?) has a good point about calling the script remotely.  But
I was trying to figure out what the script actually does and I couldn't find
a value for $sql...but my guess is that it looks for new members of some
sort and gives them a random password?  Is this something that could be
performed as part of some other task?  Perhaps, make it part of the login
process for new users?  Obviously, I don't know the whole scope of the
problem but often times, while cron may be the most elegant option, there
are other places where a task may be completed without interfering too much
in the workflow for the user or the performance of the system.  I guess what
I'm suggesting is that you revisit the problem to see if there are more
"event driven" ways of solving it rather than doing it in a repeated
fashion.

Also, in this line:
> my $password = join '', ("1".."9","a".."z","A".."Z",0..9)[map {rand 36}
0..9];
why use "1".."9" AND 0..9?  doesn't this give you the same characters as
simply 0..9? and why rand 36?  aren't there a lot more than 36 characters in
your array?  Just curious...  looks clever, though.

Good luck!

-peter

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 12, 2002 7:22 AM
To: Sven Bentlage; [EMAIL PROTECTED] [EMAIL PROTECTED]
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]

Reply via email to