Get Paid to Participate - up to $1 per post!     Twitter     Facebook
Hosting Discussion
 

Hosting Discussion > Web Hosting Forums > Website Development & Design > Shell script - System Check... What's wrong?
forgot password?



FORUM SUPPORTERS:

Reply


Old
  Post #1 (permalink)   01-23-2002, 11:21 AM
hypernatic.net
 
Posts: n/a

Status:
Hi I made a script that keeps me uptodate of what happens on my server:

Here is the shell part:
Quote:
#!/bin/sh
###################
# (C) 2002 hypernatic.net
###################

mailq >spamlist.txt
locate mp3|locate .r01 >warezlist.txt
ps aux >psauxlist.txt

./syscheck.pl

rm -f *.txt
Now the perl script that mails it all
Quote:
#!/usr/bin/perl
###################
# (C) 2002 hypernatic.net
###################

open (mque,"./spamlist.txt");
@mque= <mque>;
close (mque);

open (warez,"./warezlist.txt");
@warez= <warez>;
close (warez);

open (@psaux,"./psauxlist.txt");
@psaux = <@psaux>;
close (@psaux);

print "@psaux";

# Open The Mail Program
open(MAIL,"|/usr/sbin/sendmail -t");

print MAIL "To: user\@host.com\n";
print MAIL "From: root\@localhost (SysCheck Daemon)\n";
print MAIL "Subject: SYSCHECK REPORT\n\n";
print MAIL "################################################# ###############################\n";
print MAIL "|------------------------------[ SPAM REPORT ]------------------------------|\n\n";
print MAIL "@mque\n\n";
print MAIL "|------------------------------[ SPAM REPORT ]------------------------------|\n\n";
print MAIL "################################################# ###############################\n\n";
print MAIL "|-----------------------------[ WAREZ REPORT ]------------------------------|\n\n";
print MAIL "@warez\n\n";
print MAIL "|-----------------------------[ WAREZ REPORT ]------------------------------|\n\n";
print MAIL "################################################# ###############################\n\n";
print MAIL "|---------------------------[ PROCESSES REPORT ]------------------------------|\n\n";
print MAIL "@psaux\n\n";
print MAIL "|---------------------------[ PROCESSES REPORT ]------------------------------|\n";
print MAIL "################################################# ###############################\n";
close (MAIL);
Now for some reason, it WONT send me the @psaux....

Does anyone know WHY?
 
 
 


Old
  Post #2 (permalink)   01-26-2002, 07:03 AM
HD Addict
 
Homer's Avatar
 
Join Date: Jan 2002
Posts: 122
Send a message via ICQ to Homer

Status: Homer is offline
Quote:
Originally posted by hypernatic.net
open (@psaux,"./psauxlist.txt");
@psaux = <@psaux>;
close (@psaux);
open (psaux,"./psauxlist.txt");
@psaux = <psaux>;
close (@psaux);

should fix it
 
 
 


Old
  Post #3 (permalink)   02-17-2002, 12:48 AM
HD Newbie
 
Join Date: Feb 2002
Location: Northern, California.
Posts: 12
Send a message via ICQ to Tim Greer Send a message via AIM to Tim Greer Send a message via MSN to Tim Greer Send a message via Yahoo to Tim Greer

Status: Tim Greer is offline
Hi,

Ooops, Homer forgot to remove the @ in the closing fle hanlder in his fix. You will still need to fix the "close (@psaux)" part.

open (@psaux,"./psauxlist.txt");
@psaux = <@psaux>;
close (@psaux);

Should be:

open (psaux,"./psauxlist.txt");
@psaux = <psaux>;
close (psaux);

Just do it like you do the other's. The file handler is not an @array. There are better ways to do this, but this should work or that part of reading the file contents anyway.
__________________
Regards,
Tim Greer -- tim@chatbase.com
Programming, administration, security, and whathaveyou...
<Insert witty sig, impress many>
 
 
 
Reply

Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Sponsored By: