Re: Getting the total size of a directory

2004-01-05 Thread Rus Foster
On Sun, 4 Jan 2004 [EMAIL PROTECTED] wrote:

> I'm running out of web space and want to write a script that tell me the size
> of certain directories so I can see where the hog is.
>
> Can anyone give me some quick code?

A shell script might be even faster with du -s /tmp | sort -n

Rus

-- 
e: [EMAIL PROTECTED]
t: 1-888-327-6330
www.jvds.com - Root on your own box
www.vpscolo.com - Your next hosting company

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




Re: Get file size without downloading

2003-12-10 Thread Rus Foster
On Wed, 10 Dec 2003, usef wrote:

> Hi,
> Is there any way to get the size of a file without downloading it?
> I want to write a program using LWP to download a file only if it is bigger
> than 3K but smaller than 500K.
> So I need to know the file size in the first place.
>

Hi,
FTP or HTTP?

Rgds

Rus
-- 
e: [EMAIL PROTECTED] | Linux + FreeBSD Servers from $12.50/mo
e: [EMAIL PROTECTED]   | Full Root Access
m: +44 7919 373537  | Free Trial Account
t: 1-888-327-6330   | http://www.jvds.com


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




Re: "HTH"

2003-07-24 Thread Rus Foster
On Thu, 24 Jul 2003, Jeff Westman wrote:

> Hi,
>
> Okay guys, what does this mean?  Several of you 'sign' with this.
>
> HTH (lol)
>

Hope That Helps

HTH :)

Rus
--
www: http://jvds.com   | Virtual Servers from just $15/mo
MSNM: [EMAIL PROTECTED] | Totally Customizable Technology
e: [EMAIL PROTECTED]   | FreeBSD & Linux
   10% donation to FreeBSD.org on each purchase


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



Re: Checking for a directory

2003-07-24 Thread Rus Foster
On Thu, 24 Jul 2003, LI NGOK LAM wrote:

> if ( -d $path ) { print "Directory" }
> elsif ( -f $path ) { print "File" }
> else { print "Not exist" }
>
> HTH

Cheers all. Think I was trying to be to clever for my own good

RGds

]Rus
-- 
www: http://jvds.com   | Virtual Servers from just $15/mo
MSNM: [EMAIL PROTECTED] | Totally Customizable Technology
e: [EMAIL PROTECTED]   | FreeBSD & Linux
   10% donation to FreeBSD.org on each purchase

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



Checking for a directory

2003-07-24 Thread Rus Foster
Hi All,
Just trying to work out the code to test if a path is a directory or file.
Looked over the stat function but doesn't quite seem right. Can someone
give me a clue

thanks

Rus

-- 
www: http://jvds.com   | Virtual Servers from just $15/mo
MSNM: [EMAIL PROTECTED] | Totally Customizable Technology
e: [EMAIL PROTECTED]   | FreeBSD & Linux
   10% donation to FreeBSD.org on each purchase

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



Being a moron CGI.pm

2003-07-12 Thread Rus Foster
Hi All,
I know what I'm about to ask is a really stupid question but I just can't
get my head around my first outing with CGI.pm. I've RTFM as appropiate
but getting nowhere. All I want to do is dump a list of variable and their
values which have been parsed to a script. So far I have

#!/usr/bin/perl

use CGI qw(:all);
$query = new CGI;

@names = $query->param;


print header(), start_html();
foreach $entry (@names)
{
print em(param('$entry'))." \n";
}

which I thought would work

If I put print "$entry \n"; that prints out the variables but not the
values. I know its going to be something stupid..What is it?

Cheers
Rus

-- 
www: http://www.65535.net   | Hosting - Shell Accounts
MSNM: [EMAIL PROTECTED] | Virtual Servers from just $15/mo
e: [EMAIL PROTECTED]   | Community: http://www.65535.org
t: +44 (0) 7092016595   | 10% Donation on every FreeBSD product

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



Re: Free cgi-bin?

2003-03-17 Thread Rus Foster
On Mon, 17 Mar 2003, Liebert, Sander wrote:

>
>
> > Does anyone know of a free cgi-bin. I am having some problems with a
> > script and wanted to narrow it down to rule out email.  I don't need a
> > free website, just a place that can run and execute my script. I have
> > searched on google, but I'm only coming up with free web hosts.
> >
>

We run a freeshell server. You can signup at http://freeshells.65535.net
and I can enable support for cgi so you can test things out

Rgds

Rus
--
http://www.65535.net | MSN: [EMAIL PROTECTED] | e: [EMAIL PROTECTED]
  "More bits for your bite"
Lifetime FreeBSD + Linux Hosting and Shell Accounts
 Please respect RFC1855 and don't top post

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



MLDBM adding records

2002-10-15 Thread Rus Foster

Hi all,
 I'm trying to do a proof of concept for myself using MLDBM of basically
trying to add two records to a hash. ATM I have the following code

#!/usr/bin/perl

use strict ;
use warnings ;
use MLDBM;
use Fcntl ;

my %hash ;
my $filename = "/tmp/filt" ;
unlink $filename ;

my $db = tie(%hash, 'MLDBM', $filename, O_RDRW|O_EXLOCK, 0640) or die
("Cannot open $filename: $!\n");

   %hash = ( '1' => { url => "www.slashdot.org" , title => "News for
nerds" , lastvisit =>" 10" } );
  %hash .= ( '2' => { url => "www.slashdot.org" , title => "News for
nerds" , lastvisit =>" 10" } );


  print Data::Dumper->Dump ( [\%hash ]);
  undef $db;
  untie %hash;

and I'm getting

Can't modify private hash in concatenation (.) or string at ./perldbm line
15, near ");"

As such what do I have to do to add entries to the hash (without defining
it all in one hash?) The reason is that I want to writ eaprorgam that will
add a hash each time it is run so just trying to do it on a simple prog
ATM

Rus
-- 
http://www.fsck.me.uk - My blog
http://shells.fsck.me.uk - Hosting how you want it.



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




Re: uptime

2002-10-03 Thread Rus Foster

On 3 Oct 2002, chad kellerman wrote:

> Hi everyone,
>
> What would be the easiest way to find the uptime of a linux
> machine?  I don't want to use a system call.  Is there a module I can
> use? Or do I have to open /proc/uptime and calculate it thru there?
>

Prase the output of the command uptime

rus
--
http://www.fsck.me.uk - Rant wibble wave
http://shells.fsck.me.uk - Hosting and stuff


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




Re: ascertain current username

2002-08-16 Thread Rus Foster

On Fri, 16 Aug 2002 [EMAIL PROTECTED] wrote:

> Hello,
> does anybody know a possibility how to ascertain the current User (User Id,
> Username) ?
> I thougt of using a module but couldn't find one.
>
>
> greetings
> Stefan
>

Or following up on my own post (which is bad) just found out you could
just do...

use English;
print $UID;
print $GID;

doh

Rus
--
http://www.fsck.me.uk - Rant wibble wave
http://shells.fsck.me.uk - Hosting and stuff


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




Re: ascertain current username

2002-08-16 Thread Rus Foster

On Fri, 16 Aug 2002 [EMAIL PROTECTED] wrote:

> Hello,
> does anybody know a possibility how to ascertain the current User (User Id,
> Username) ?
> I thougt of using a module but couldn't find one.

Have you tired parsing the output from the commands "id -h" and "id -u"?

Rgds

Rus
--
http://www.fsck.me.uk - Rant wibble wave
http://shells.fsck.me.uk - Hosting and stuff


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




Sys::Syslog

2002-04-29 Thread Rus Foster

Hi all,
 I've wonder if you get help me with a problem I'm having. ATM I've
managed to log to my local syslog using the following code

#!/usr/sbin/perl

use Sys::Syslog qw();

$user = $ENV{'USER'};
openlog($0,'','user');
syslog('info', "$user logged this comment");
closelog;

What I would however like to do is log to a remote machine without having
to put something like

*.info  @loghost

in my /etc/syslogd.conf

Is this possible? Looking over the man page it doesn't seem so but I might
be missing something

Rgds

Rus


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




FIFO handeling

2002-04-25 Thread Rus Foster

Hi All,
 I've got a small problem with a FIFO. Using the following code snippet

#!/bin/perl

my $fifo="/tmp/tp9100";

open(IN,"$fifo") || die "Can not open $fifo";

while() {
print $_;
}


Now if I do something like "cat > /tmp/tp9100" and pass characters this
works. However when I send ^D the script exists. Is there anyway to avoid
this and keep the file handel open

Rdgs

Rus Foster


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




Regexp on variable

2001-12-13 Thread Rus Foster

Hi All,
I've google for this but for the life of me I can't find it. Basic
premise is that I have a variable, want to run a regexp over it and then
put the results back into itself. So far I have

my $foo="bar";
$_ = $foo;
$foo =~ s/bar/goo/g;

There has to be a better way hasn't there?


Rus



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