nice .. maybe i should start to learn a bit php ..
<?php passthru("/enter/command/here" ?>
works like a dream, especially if you want the fortune program to be seen on your webpage...............
nice .. maybe i should start to learn a bit php ..
How would I get my system uptime to automatically show on my page?
How would I get my system uptime to automatically show on my page?
<?php passthru("uptime" ?>
worked for me
with passthru("uptime"How would I get my system uptime to automatically show on my page?; you get loads of other stuff that's not quite so useful. I've started using this to break it up:
There's probably a quicker/easier way to do it, but it worksCode:<?php $info = exec("uptime"); $info = split(",", $info, 7); $days = split(" ", $info[0], 4); echo "My box has been up for ".$days[3].$info[1]; ?>
It's probably a heck of a lot better to just read from /proc/uptime. There are two numbers in that file, the first is the number of seconds that your computer has been up. From there it is a simple calculation to work out days, hours, minutes and seconds![]()
How would I use this for shutdown? As far as I can work out, the resulting text with this code will be what the command spits out. But with shutdown, I will have to wait until the computer displays its last message before it is shutdown, right? By that time, everything will be stopped so will no longer work. In turn, I will never get the page to display. Can someone come up with some code just to say whether shutdown executed or not and then display it before the web server is shutdown?
Cheers
Bookmarks