Hey I was wondering if it was possible to make a script that will report the PC's actual uptime. It would need to be triggered by a user in the hub via "!uptime" or something similair. If someone could have a go would be great. Thanks.
No, the uptime OF THE ACTUAL PC THE HUB IS BEING RUN ON. Like in Invision mIRC how it tells O/S and Uptime. That kinda thing...
Nah man :( Like the uptime of the PC. When i used to run my hub on Linux, it had an Uptime script which would echo Hub Uptime followed by PC Uptime like...
Hub's Uptime: 1 day 2 hours
PC's Uptime: 4 days 3 hours
etc...
That's the kinda thing i'm after... :S
QuoteAs for the the pc's uptime. I haven't a clue. Tho Windows networking does keep track of that, I've no idea how to retrieve that info for a scriptds usage.
Well a friend of mine wrote a little Tool he uses on his Server to show a couple of statistics on his Intranet. Just that it has nothing to do with Ptokax.
As long as the Tool is running you can use these variables in a htm page on the same computer:
for Internet Status -> @online@
for System Total Online -> @totaltage@
for Windows Total Online since first start of Tool -> @akttage@
Computer in same Network -> @netzwerk@
whereas the Variables show up as the Info aqquired
perhaps someone could adapt that program ServCheck-v1-4 (http://bouncernet.ch/downloads/ServCheck-v1-4.rar) so that it would work with the Hub as well. If i am lucky i could probably get the source files (if high interest)
Heya Peeps :-)
Maby Someone with a better knowledge of lua than me can convert this VB script.
V.B SCRIPT
'Uptime script 0.000003 by Gadget
Dim Uptime,sBotName,sRegPath,sStart,sStop,iUptime,iDowntime,iBoots,iCrashes,iResets,iPackets,sLogStart,sSaved
Sub Main()
sBotName="Uptime"
sRegPath="HKEY_LOCAL_MACHINE\SOFTWARE\NeoModus\Hub\Stats\"
Set Uptime=New clsUptime
tmrScriptTimer.Interval = 60000
tmrScriptTimer.Enabled = True
End Sub
Sub tmrScriptTimer_Timer()
iUptime=iUptime+DateDiff("s",sSaved,Now)
WriteReg
End Sub
Sub DataArival(curUser,sCurData)
If Left(sCurData,1)="<" Then
If Right(LCase(sCurData),8)="> uptime" And curUser.bOperator Then
iTotalUptime=iUptime+DateDiff("s",sSaved,Now)
sMsg="Hub uptime and statistics since "+sLogStart
sMsg=sMsg+vbCrLf+"Last hub boot"+vbTab+sStart
sMsg=sMsg+vbCrLf+"Current uptime "+vbTab+FmtSeconds(DateDiff("s",sStart,Now))
sMsg=sMsg+vbCrLf+"Total uptime "+vbTab+FmtSeconds(iTotalUptime)
sMsg=sMsg+vbCrLf+"Total downtime "+vbTab+FmtSeconds(iDowntime)
sMsg=sMsg+vbCrLf+"Reliability "+vbTab+vbTab+CStr(CCur(iTotalUptime/(iTotalUptime+iDowntime)*100))+" %"
sMsg=sMsg+vbCrLf+"Boots "+vbTab+vbTab+cStr(iBoots)
sMsg=sMsg+vbCrLf+"Crashes "+vbTab+vbTab+cStr(iCrashes)
sMsg=sMsg+vbCrLf+"Resets "+vbTab+vbTab+cStr(iResets)
sMsg=sMsg+vbCrLf+"Packets "+vbTab+vbTab+cStr(iPackets)+" ("+CStr(CCur(iPackets/(iTotalUptime/60)))+" per minute)"
curUser.PrivateMessage CStr(sBotName),CStr(sMsg)
End If
End If
iPackets=iPackets+1
End Sub
Class clsUptime
Sub Class_Initialize
ReadReg
If sLogStart="" Then
sStart=CStr(Now):sStop="-":iUptime=0:iDowntime=0:iBoots=0:iCrashes=0:iResets=0:iPackets=0:sLogStart=CStr(Now)
WriteReg
Exit Sub
End If
If sStop="-" Then
iCrashes=iCrashes+1
sStart=CStr(Now)
ElseIf DateDiff("s",sStop,Now)<5 Then
iResets=iResets+1
Else
iBoots=iBoots+1
iDowntime=iDowntime+DateDiff("s",sStop,Now)
sStart=CStr(Now)
End If
sStop="-"
WriteReg
End Sub
Sub Class_Terminate
iUptime=iUptime+DateDiff("s",sSaved,Now)
sStop=CStr(Now)
WriteReg
End Sub
End Class
Sub ReadReg
On Error Resume Next
Set wshShell = CreateObject("WScript.Shell")
sStart =wshShell.RegRead(sRegPath+"Start")
sStop =wshShell.RegRead(sRegPath+"Stop")
iUptime =CDbl(wshShell.RegRead(sRegPath+"Uptime"))
iDowntime=CDbl(wshShell.RegRead(sRegPath+"Downtime"))
iBoots =CDbl(wshShell.RegRead(sRegPath+"Boots"))
iCrashes =CDbl(wshShell.RegRead(sRegPath+"Crashes"))
iResets =CDbl(wshShell.RegRead(sRegPath+"Resets"))
iPackets =CDbl(wshShell.RegRead(sRegPath+"Packets"))
sLogStart=wshShell.RegRead(sRegPath+"LogStart")
End Sub
Sub WriteReg
On Error Resume Next
Set wshShell = CreateObject("WScript.Shell")
wshShell.RegWrite sRegPath+"Start",sStart,"REG_SZ"
wshShell.RegWrite sRegPath+"Stop",sStop,"REG_SZ"
wshShell.RegWrite sRegPath+"Uptime",CStr(iUptime),"REG_SZ"
wshShell.RegWrite sRegPath+"Downtime",CStr(iDowntime),"REG_SZ"
wshShell.RegWrite sRegPath+"Boots",CStr(iBoots),"REG_SZ"
wshShell.RegWrite sRegPath+"Crashes",CStr(iCrashes),"REG_SZ"
wshShell.RegWrite sRegPath+"Resets",CStr(iResets),"REG_SZ"
wshShell.RegWrite sRegPath+"Packets",CStr(iPackets),"REG_SZ"
wshShell.RegWrite sRegPath+"LogStart",sLogStart,"REG_SZ"
sSaved=CStr(Now)
End Sub
Function FmtSeconds(iSeconds)
iSec=iSeconds
iYears=Int(iSec/60/60/24/365):iSec=iSec-iYears*60*60*24*365
iMonths=Int(iSec/60/60/24/30):iSec=iSec-iMonths*60*60*24*30
iDays=Int(iSec/60/60/24):iSec=iSec-iDays*60*60*24
iHours=Int(iSec/60/60):iSec=iSec-iHours*60*60
iMinutes=Int(iSec/60):iSec=iSec-iMinutes*60
If iYears>0 Then FmtSeconds=CStr(iYears)+" years, "
If iMonths>0 Then FmtSeconds=FmtSeconds+CStr(iMonths)+" months, "
If iDays>0 Then FmtSeconds=FmtSeconds+CStr(iDays)+" days, "
If iHours>0 Then FmtSeconds=FmtSeconds+CStr(iHours)+" hours, "
If iMinutes>0 Then FmtSeconds=FmtSeconds+CStr(iMinutes)+" minutes, "
FmtSeconds=FmtSeconds+CStr(iSec)+" seconds"
End Function
http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp
Just make a script to have it output to a file and then read the file.
-NotRabidWombat
Hmmm... good idea... But seeing I have no idea about scripting, I wouldn't know where to start. Does anyone wanna have a go at making this?
like this for example (execute with the lua command line).
execute("uptime > uptime.lst")
local serverup = ""
if readfrom("uptime.lst") then
readfrom("uptime.lst")
serverup = read()
writeto()
remove("uptime.lst")
end
print(serverup)
plop
Id like to try this script and use it in my hub.
But the link to the microsoft tool is dead and i cannot seem to find it on the web site.
Can u put it on a web or find a different site with it so i can try your script?
Cheers
Sudds
Sorry after looking around a while i found it at
http://www.microsoft.com/downloads/details.aspx?FamilyID=bc18ffdb-d6fe-400b-b892-94783ae44c91&displaylang=en
i think it is the right tool. Is it?
Sudds
QuoteOriginally posted by Sudds
...i think it is the right tool. Is it?
Well..."that one" is for
NT4 and
Win2000 . :]
For
WinXP (Professional only) , there is a "microsoft tool" called
systeminfo !!!
Just open an "MS-Dos Command Prompt" (Start-->Run-->cmd)
...and type
systeminfo /? , for all available options. ;)
For more info on "this tool" , please visit ---> MS-Systeminfo (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/systeminfo.mspx)
uptime will work for XP as well
I did not note systeminfo because there are fewer formatting options and you must grep the information (I think it's find in DOS) out of the list.
-NotRabidWombat
QuoteOriginally posted by NotRabidWombat
uptime will work for XP as well...
:D You're right !!! my fault... :rolleyes:
This is because i have a WinXP Home edition and both applications doesnt work on it...LOL.
Sorry , if i've "mistaken" someone ;)
if it's possible to readout the uptime from an other application u can use AIDA32 3.90 ( latest release ) it's a real good tool
Wow! Thanks a lot Mutor. One mroe thing tho hehe... is there any way you can make just the Current System Uptime: line display, and make it display to the hub chat instead of private msg?
THX Mutor didn't know that :)
Excellent. Thanks a heap man! :)