[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] PHP as a scripting language.



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