Jump to content

Get the last reboot from Server


bplogan

Recommended Posts

I have been assigned a project to create a page that displays the last reboot times of our company servers.  All servers are running MS Server 2003.  I found a way using ASP.NET but I hate ASP.NET with a passion.  Does anyone know of a way to use PHP or javascript to accomplish this?  Or does anyone have a different approach?  I think I may have to bite the bullet and use ASP, but hopefully someone can suggest something different.  Thanks.

Link to comment
https://forums.phpfreaks.com/topic/118002-get-the-last-reboot-from-server/
Share on other sites

You could parse the log files and find the last occurance of the restart, or see if there is a specific file that is touched when a reboot occurs and use that information (with some PHP command line greps) to get the time and then do some math to figure out the time.

 

  Quote

I'm not advocating Linux, I'm just saying that Windows does suck. =P  In general.  Especially for big servers.  And I'm sure Windows' feelings aren't hurt. =)

 

Not to start a war here but saying something sucks when its been number 1 for so long is a flat out lie.

 

Windows is designed around being portable and usable by a vast number of  users.  In doing this is leaves some of us who know more about computers limited in our capabilities to use our hardware to its max. 

  Quote
Windows is designed around being portable

 

Huh? It (windows) runs on two maybe three architectures. Linux runs on like 8-12.

 

  Quote
In doing this is leaves some of us who know more about computers limited in our capabilities to use our hardware to its max.

 

And I'm sorry, but that makes no sense at all.

  Quote

How about you guys just stop bickering about an endless argument and realise the question at hand.

How to get the last reboot time on Windows using PHP..

 

I believe a few solutions have been posted, and I'll have you know it was a pleasant conversation. I don't see any flamming going on.

<?php
class weapon{
public function pick_weapon($weapon){
	$this->weapon = $weapon;
}
public function fire_weapon($weapon,$target){
	echo "You fired your ".$weapon." at ".$target;
	if(stristr($weapon, "fire")){
		echo "<br />and you burned them!";
	}
}
}
$weap = new weapon;
$weap->pick_weapon("Fire_Lazer");
$weapon->fire_weapon("Fire_Lazer","ShaunO");
$weapon->fire_weapon("Fire_Lazer","Jabop");
?>

 

:)

 

  Quote

<?php
class weapon{
public function pick_weapon($weapon){
	$this->weapon = $weapon;
}
public function fire_weapon($weapon,$target){
	echo "You fired your ".$weapon." at ".$target;
	if(stristr($weapon, "fire")){
		echo "<br />and you burned them!";
	}
}
}
$weap = new weapon;
$weap->pick_weapon("Flamethrower");
$weapon->fire_weapon("Flamethrower","ShaunO");
$weapon->fire_weapon("Flamethrower","Jabop");
?>

 

:)

 

 

Hehe, its a shame that code would output nothing but errors ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.