Re: [Perl-unix-users] Read the Last line in a file

2001-02-15 Thread $Bill Luebkert
Tim Hammerquist wrote: > > "Elston, Jeremy" wrote: > > > > Greetings... > > > > Peter's solution is the one I would recommend unless you are reading large > > files and/or your system has little memory available. By reading into an > > array, the entire file will be pulled into memory. If memor

Re: [Perl-unix-users] Read the Last line in a file

2001-02-15 Thread Tim Hammerquist
"Elston, Jeremy" wrote: > > Greetings... > > Peter's solution is the one I would recommend unless you are reading large > files and/or your system has little memory available. By reading into an > array, the entire file will be pulled into memory. If memory use is an > issue, you could use som

RE: [Perl-unix-users] Read the Last line in a file

2001-02-15 Thread Elston, Jeremy
Greetings... Peter's solution is the one I would recommend unless you are reading large files and/or your system has little memory available. By reading into an array, the entire file will be pulled into memory. If memory use is an issue, you could use something like this: - open(FILE, "m

Re: [Perl-unix-users] Read the Last line in a file

2001-02-15 Thread Grant Hopwood
-start- > "Ricardo Cumberbatch L." <[EMAIL PROTECTED]> >at02/15/2001 08:24 AM >Hi every one I had to do a perl script but a need to know how in perl you >do to read the last line in a file, I no to read in a file but how to read >every time a need the last line in a file. Probably the bes

RE: [Perl-unix-users] SetUID?

2001-02-15 Thread Thomas_M
To set a script up as setuid 'news', do the following: chown news.news yourscript.pl chmod 4755 yourscript.pl An alternative (considered a bit more secure) is to use 'sudo'. You can configure sudo to allow a specific user (i.e. the apache user) to execute yourscript.pl as 'news'. sudo comes with

RE: [Perl-unix-users] Read the Last line in a file

2001-02-15 Thread Peter Eisengrein
There may be a better way, but this should work (untested): open(FILE,"$thefile") || die "Can't open $thefile: $!\n"; @file=; close(FILE); $lastline=pop(@file); -Original Message- From: Ricardo Cumberbatch L. [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 15, 2001 9:24 AM To: Perl

RE: [Perl-unix-users] SetUID?

2001-02-15 Thread Elston, Jeremy
Greetings... I have done something like this before. You can create a SUID wrapper (C) for the script. All necessary instructions are on p360-361 in the Camel book (rev 2 I think). Type in the 6 lines of C code, placing the name of your script in the code where applicable. There is a program

[Perl-unix-users] Read the Last line in a file

2001-02-15 Thread Ricardo Cumberbatch L.
Hi every one I had to do a perl script but a need to know how in perl you do to read the last line in a file, I no to read in a file but how to read every time a need the last line in a file. Thanks for the help folk... R.C.L. ( ^_^ ) ___ Perl-Unix-

[Perl-unix-users] RE: SetUID?

2001-02-15 Thread Peter Eisengrein
Not sure Perl is going to override the systems permissions (nor do I think you'd really want it to). I think your options are two: [1] system("su -c inndstart news"); ### or [2] run the script from the news' crontab -Original Message- From: Martin Moss [mailto:[EMAIL PROTECTED]] Sent:

[Perl-unix-users] SetUID?

2001-02-15 Thread Martin Moss
All, On a linux box, I need to write a CGI script which will allow me to restart an INN server. The problem I have is that with the latest version of INN only the "news" user can restart inn (most specifically only the news user can issue the command 'inndstart') How can I write a CGI script wh