|
|
|||||||
Okay since parsing is not my forte, I'm looking for some more help with the following. I need to know how long a Server or Workstation has been up and running. I can find this by shelling out and running either one of the following. NOTE: I am using KiXtart v3.63 net statistics workstation net statistics server Which comes back with results like this: net statistics workstation
Now I can use @TIME to get the current time but I have an issue here. During a user logon I want to check and see how long the system has Using either this method (or any other method) how can I determine and place Thanks in advance for any assistance. |
||||||||
|
|
|||||||
Hey DOC, Have you had a look at the ResKit tool UPTIME? quote: I know, it's external, but you don't need to calculate from current time and with the output, and it's all on one line so it's easy to parse. Sample code: code: |
||||||||
|
|
|||||||
Hi Les, Thanks for the quick reply. Yes, I know of the utility and I could use that, but I'm still back to part of my original problem. Parsing out the vital information from the line and comparing and then taking action. I guess I could find the minutes portion and then grab out the three characters from the left and then strip out blanks which should leave me with either 1 or 2 numbers. Then I could do IF > 1 do task or IF < 1 do other task? Does this sound right? or is there maybe a better way? I'll start trying to strip out the wanted portion and see where I get. I guess I need to learn parsing and do while stuff a little better, it keeps coming up over and over lately. |
||||||||
|
|
|||||||
Hi DOC, Being as I'm lazy, and I think my idea needs less code, here's what I came up with: code: The reason I wrapped the substr() in val() is 'cause I'm arbitrating the length of $day to 5 chars which could conceivably exceed 3 digits. The val() will rtrim the trailing chars. You probably want interger anyway for compares. Be my guest and spit polish it. It's just a proof-of-concept. HTH |
||||||||
|
|
|||||||
Wow! Les, I think your going to have to change your signature again. Maybe to PARSING GUY or something. I'm banging my head I see what your doing, why the Hell can't I think of these things when I want them. Maybe I need to change to a different JOLT Cola or something. Thanks again Les great job. If I run into any problems on any other systems I'll let you know, but so far so good. |
||||||||
|
|
|||||||
Eh DOC, Don't be too hard on yourself. It's probably that love ![]() ![]() You had it at your finger tips. To quote you, "I guess I could find the minutes portion and then grab out the three characters from the left and then strip out blanks..." I'm still learning from the master Bryce (I genuflect to him). Check out his sample. |