Simon336697
asked on
Determining the last time a perl script ran
Hi guys!
We have an NT domain where we have a perl script that should run every hour.
This changes the daily password on the machines it is run on.
What Id like to find out is retrieve a list of all machines where this script has not run in the last hour or two.
Let's say the perl script is called "run.pl".
Any help greatly appreciated.
Simon
We have an NT domain where we have a perl script that should run every hour.
This changes the daily password on the machines it is run on.
What Id like to find out is retrieve a list of all machines where this script has not run in the last hour or two.
Let's say the perl script is called "run.pl".
Any help greatly appreciated.
Simon
ASKER
Good question mate.
I believe it does write to a log file.
I believe it does write to a log file.
ASKER
Chris!
The perl script runs every hour on each NT box
It outputs to a file called everyhour.log.
We can manually open this file and check the last 20 lines for:
Password change success
or
Password change failed
To give you the full picture Chris (which explains totally why Im trying to call on a guru like you) of what we have to do:
Manually we have to do the following if the password is not correct on the NT box.
1) Change the hjbox user account to the correct password for the DAY
2) To ensure that the the perl script updates the password on the hour and for every day, it looks at a file called setpass.log which has the current date/time. If this is wrong, then the perl script will fail.
The format of the file is:
Production: 0:hjbox:27:6:20:05
where 27 is the day of the month
6 is the month number
20 is the century
05 is the year
If the date in the log file is not shown as today's date, we need to manually set this date in the log file.
Simon
The perl script runs every hour on each NT box
It outputs to a file called everyhour.log.
We can manually open this file and check the last 20 lines for:
Password change success
or
Password change failed
To give you the full picture Chris (which explains totally why Im trying to call on a guru like you) of what we have to do:
Manually we have to do the following if the password is not correct on the NT box.
1) Change the hjbox user account to the correct password for the DAY
2) To ensure that the the perl script updates the password on the hour and for every day, it looks at a file called setpass.log which has the current date/time. If this is wrong, then the perl script will fail.
The format of the file is:
Production: 0:hjbox:27:6:20:05
where 27 is the day of the month
6 is the month number
20 is the century
05 is the year
If the date in the log file is not shown as today's date, we need to manually set this date in the log file.
Simon
To ensure I understand the process you want correctly this is what I'll do:
1. Read list of computers from Text File
2. For Each computer in the list look for an "everyhour.log" file and check the Modified Date.
3. If the Modified Date is more than an hour off then flag the password to be reset
4. Read the SetPass file (is this just one line?) and correct the entry if it's wrong.
Throughout the script all actions will be logged to a seperate file on the server running the VbScript.
At the moment I'm still staying away from exporting the computer list from WinNT or AD, however, that's possible (and quite easy) if you want it to happen that way.
Is all that acceptable?
Chris
ASKER
Mate you are all spot on with your assumptions.
For step 4. where you say is it just one line, yes it is.
I cant thank you enough for doing what you are doing.
Simon
For step 4. where you say is it just one line, yes it is.
I cant thank you enough for doing what you are doing.
Simon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Chris thank you so much.
I will let you know.
Simon
I will let you know.
Simon
Does the Perl script write to a log file at all?
It would be easy enough to pick up the creation or modified date of that log file. I'm not sure how else you would see if a Perl Script ran or not.
Chris