No uptime stats when running mod_ruid2 + cPanel jail..

I’m using the below page to monitor and collect some of the most important servers I got, see:

But ran into an issue with permissions when running under mod_ruid2 + cPanel jail, it won’t collect some of the vital statistics, merely the disk space, so that’s no good.
I could only think of one easy solution to it. A cronjob!
First, I renamed uptime.php (the original with PHP code) to uptime_fix.php, then added crontab with:

crontab -e

And added this line:

0 * * * * php /the/path/to/uptime_fix.php > /the/path/to/uptime.php

That will circumvent the permissions issue, but remember to add the cronjob under a user which has adequate permissions. Another thing, be sure to read this comment. After that, all is good. There’s a better way? Do tell.

By the way, the contents of “uptime.php” will just look something like this:



k0nsl is a programmer, server administrator, designer, moderator, spokesman and factotum of a wide-variety of web pages. You can reach k0nsl via e-mail — i.am@k0nsl.org.


  1. By the way, I just noted it may be wiser to run with the “-f” flag. I changed my cronjob to reflect that.
    When running it without the “-f” flag it may output ‘powered by blah blah’ into your dummy “uptime.php”. So check that out, otherwise it won’t be parsed and server will appear to be “down”.

  2. You did not specify which user but never use the root user for such purposes. The reason is that should your PHP script become compromised via a web application exploit, the code in it would be executed as root. Imagine the problems if a shell_exec(rm -fr /) were to run as root.

    • Hi Mr. Huckaby,

      Yes, good advice. I run it as the actual user and not via the root user.

Leave a Reply

Your email address will not be published. Required fields are marked *