Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi all, Quick question, does any

Status
Not open for further replies.

JaybOt

Programmer
Apr 18, 2001
101
GB
Hi all,

Quick question, does anyone know how to get /usr/bin/mailq output to display in a browser. Basicaly i wrote some code that runs mailq, and displays the output to a browser, i am currently wrighting some simular code (off site) and do not have the original file to work from, so if anyone has, or knows the basic code to do this ( i know its simple, i just cant get it to work right now) please, please, please can you supply the full code, from #!/usr/bin/perl to END_HTML or what ever method you choose.

Again, i know this is simple and can be done with about 5 lines of code, but my brain is like cabage today!

JayBot. "Always know what you say, but don't always say what you know!"
 
I think this will do it. It may need some minor tweaking (like the path to mailq perhaps).
Code:
#!/usr/bin/perl

open(MAILQ, "mailq|");
@mailq = <MAILQ>;
close MAILQ;

print <<END;
Content-type: text/html

<html>
<head>
<title>MAILQ Output</title>
</head>
<body>
<h2>MAILQ Output</h2>
<pre>
END
print @mailq;
print <<END;
</pre>
</body>
</html>
END
exit 0;
1;
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thanks tsdragon! &quot;Always know what you say, but don't always say what you know!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top