im running Win2k Pro, PHP4, and MySQL. I was wondering if i could make a uptime.php that would display my b0x's uptime. if any of you know how i could do such a thing, plz e-mail me back. thanks.
Uptime script for php
echo "Up less then 24 Hours\n";
echo "Point, Click, Crash\n";
very funny, actually im on my third week of uptime right now.
Dump the windoze @!#$, get UNIX and run:
<?php
$uptime = passthru ("/usr/bin/uptime");
echo "<font face=\"Verdana, Helvetica\" SIZE=\"1\">$uptime</font></p>";
?>
in a php file.
This only works to get the uptime from the puter that the PHP file is on.
It simply runs /usr/bin/uptime (uptime) and pastes the result on the PHP page.
I enjoy how one person asks a legitmate question and all you unix jerks can\'t give him a real answer. Windows is a real OS morons. I know you may not like it, but let the rest of us use that among other OS\'s okay? I swear to gosh, you only give a bad name to yourselves.
why run windows for a personal server?
it cost alot it performs like crap and you cant do what you want
with unix your FREEEEE do what you want how you want it
all kinds of great free software
and thanks to teh guy who posted
<?php
$uptime = passthru ("/usr/bin/uptime");
echo "$uptime</p>";
?>
its exactly what i was looking for
Luc
Unix sucks for everything accept a server environment. Its decent at high performance CAD too. Unix sux if its not command line, its all laggy and performance is bad.
I run apache off my win2k box, and I have not had one crash or one problem since I first started it up. I not only run a server off of it that out performs unix/linux servers, I also use this computer for burning CDs, my personal music player, to run a company from, and I play games on it like Q3 and CT.
Yup, so when did I last (re)start my computer? The exact date was September 29th 2000, which I had to restart it for in order to use new software settings. It has been running incredibly smooth since then.
Andy:
You do not have much to come with here. I will try to make some things clear for you.
Games:
Q3 is ported to Linux so you can run that in Linux as good as in windows. If CT (Dont know if you mean UT or CS or if CT is some game i don't know of) is UT, then it is ported to Linux. And if it is CS then the HLDS files + CS are also ported to Linux, so you can play those games without using a windows emulator like Wine or VMware in Linux.
Music:
XMMS is just an example of all the great audio players there is for Linux so it does not matter if you play your Barry White MP3's in Linux or windows, so nothing interesting there...
Company:
You know that shining package with Office XP you see in your closets computer store and you probably drowl about it all nights long and which you are probably looking for in some warez channel on IRC right now beacuse you dont want to buy it. Well, dump it. Download StarOffice for Linux from Sun Microsystems which is as good as all the M$ Office's and it is also free (legaly). And i guarantee you that you get it with a much faster and stable line (from Sun's public FTP or such that is) instead of Dark_Shadow35 in #warez on dalnet which we say is on ISDN in northern Russia (just an example).
Well, well, if you think that Linux is to complicated for you then dont use Linux. But dont come and talk @!#$ about it in disscusion groups neither just beacuse You dont understand it. Then everyone will be happy, OK?
Now.. how old am I? I am 15. So you see, we "script-kiddies" can be right to. And I did'nt learn Linux by a SAMS "Learn Linux" -type of book or some @!#$ like that. I learned it my self. Hope this solves some bad thoughts you have against Linux.
Happy weekend,
// MBmaster
I already knew all you have told me. Of course Linux has similar programs to Windows, not only are those programs different in power and function, but Linux still lacks a lot in terms of software. I could go on listing software all day for you, but I would rather not. All I will say is counter strike, half life, red alert 2, unreal tournament, adobe photoshop 6, 3d studio max, and max payne. There are many more titles like that, and I know about windows emulators. I simply am saying that most of you linux kids feel that windows is inferior to your linux, and that somehow linux is better. Its quite the opposite. Windows has become a standard, and with that comes all the software, support, compatability, and interactivity. I don't debate that linux is a good o/s, I simply suggested that Linux is good for servers, but does not function as well as windows for a desktop program because it lacks major software and such. I personally like the GUI of linux over Windows. I also think its an error on your part to assume that Windows sucks for a server. Ditch all your stereotypes about Windows until you have commited yourself to running a Windows 2k server.
So do you know how to parse the uptime to display only the time it's been up. I don't want the time it was executed and load averages. I just want the time.
Andy:
You are as right as one can be about M$ having better commercial's and such and then naturally all the companies see that this is a good selling way to develop software for, this is however changing as more and more software companies see that Linux is worth make software for to, and more and more companies follow.
Also game companies are changing direction, take ID Games as an example, both Q3 and RTCW is developed for Linux, and ID Games are a game company others like to look up to so hopefully the rest will follow.
Linus Torvalds haven't ever made one singel commercial for Linux which, as we all know, Bill Gates have. Sure IBM, Oracle and more got Linux commercial's but that is not for Linux but for -their own products featuring Linux- so it is not the same as M$.
I think you already know all this but it's just a reminder of why most of the software market develope for windows instead of Linux.
Joe:
You have to run a PHP script or such which blocks special words/sentenses such as the load average and users logged on to it and eventually re-edits the time so it is displayed in another way.
Although I don't know any good script which does this so you have to look for it ure self.
Um, you maybe already figured this out but.. hope this helped if you haven't..
This works for me
tengil% uptime
4:32PM up 1:52, 2 users, load averages: 0.00, 0.00, 0.00
tengil% uptime | awk '{print $3."\b "}'
1:52
This should work on windows...
<?php
$uptime = passthru ("uptime");
echo "$uptime</p>";
?>
I used an uptime executable I found on the Microsoft website, and shoved it in my WINNT\System32 folder. I downloaded the uptime.exe at:
http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp
Hope I've been helpful 6 months later . I don't want to get into any of the linux/windows arguing... that's just petty.
ok, all bitterness aside.
I found a solution. It's a convoluted messy solution, but it's the best that I've found so far, so bear with me.
D/L and install MotherBoardMoniter 5.x, and CoolMon. CoolMon gets some of it's info from MBM. But the cool part is that CoolMon spits out it's results via XML, which can then be imported into a php script.
An example can be found here;
http://209.105.194.182:800/pyxis/pyxis.htm
That's very useful Bryan, thx
I tried to format the output, but apparantly passthru(); writes it right away, no matter what I tried it kept writing it. Is there no way at all to alter the output?
<?php
passthru("uptime");
?>
Whatever I did with ^ that, it kept giving me the basic line.
I'd like to dispel a few issues I have with this thread.
First things first, this was not started to cause a debate between Linux users, Unix users, and Windows users.
Second, not a single one of you is answering his question for a WINDOWS machine, which was originally the entire point. I will do so shortly.
Third, you Unix users are ok. I respect your knowledge of that OS. Don't force it on me. Same goes for you Linux users. It doesn't matter who's machine outperforms another, because in the great big world, nobody cares what your stuff is served from, they just want it now. My machine isn't sitting on your desk 24/7, so don't complain about what I use for an OS. I can probably do things with my Windows 2000 Advanced Server machine that you Linux users can only dream about, because let's face it. Less than half of you actually know how to write your own kernel, and the ones that do don't bother screaming at everyone because they know the OS is doing for them what it needs to. Get over your high and mighty attitude, solve your own problems, and leave everyone else alone. If you have something CONSTRUCTIVE to say, do so. That is all.
As for the real answer to this question, which I doubt will be read by anyone who needs to read it, I'll post that at the end of this thread.
\\"Yup, so when did I last (re)start my computer? The exact date was September 29th 2000, which I had to restart it for in order to use new software settings. It has been running incredibly smooth since then.\\"
LOL. In UNIX you dont have to reboot just because of new software settings.