[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] PHP as a scripting language.
- Subject: Re: [cobalt-users] PHP as a scripting language.
- From: Brad Hubbard <brad@xxxxxxxxxxxxxxxx>
- Date: Wed Jun 27 15:22:23 2001
- Organization: Congo Systems
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
While we're at it..... here's a little script I use which I find quite handy.
You need the CGI version of PHP of course and you may want to edit it to suit
your needs (at least edit the email address :-) Put it in a file (I call it
chkstat but...... whatever) and edit your crontab to run it
daily/hourly/weekly.
#!/usr/local/bin/php -q
<?php
$admin = "admin@xxxxxxxxxxx";
$subject = "Daily Report ".`hostname`;
$body = "Daily Report\n\n";
$additional_headers = "";
// You can mix and match here. If you don't
// like something comment it out or delete
// the line. If you want to add something
// just follow the format. Have fun.
$body .= `uptime`."\n\n";
$body .= `ps auwx|grep httpd`."\n\n";
$body .= `postgresql status`."\n\n";
$body .= `df`."\n\n";
$body .= `top -bn1`."\n\n";
$body .= `free`."\n\n";
$body .= `last root|head`."\n\n";
$body .= `ipchains -L -n`."\n\n";
mail( $admin, $subject, $body, $additional_headers );
?>
Cheers,
Brad
--
Brad Hubbard
Congo Systems
12 Northgate Drive,
Thomastown, Victoria, Australia 3074
Email: brad@xxxxxxxxxxxxxxxx
Ph: +61-3-94645981
Fax: +61-3-94645982
Mob: +61-419107559