Hi all,

I am very new to Unix. Please help me to write a script.
Here is the discription of what the script should do:

The script won't need to be horribly complex; it's to check to see if the hawkagents(a process) on a server have been restarted since the last update to the Hawk rule files or the user variables file, and to generate an error message if they have not been.

-Please help me in finding last update time of a file.
-And last restarted time of a process.
-And how to capmare the date-time of above to times.

Thanks in advance.

Recommended Answers

All 6 Replies

Any particular "brand" of "unix"?
An awful lot of things claim to be "unix", even many things which only look like "unix".

Its Hp-Unix.

I think that is what you are asking.
And one thing the 'stat' command is not working on this unix box. Please help me.

Thanks for the response.

>date %s

is also not working in HP-UNIX.

Any response is highly appriciated.


What about
date '+%s'

same thing- it was written mistakly.

date "+%s"

is not working.

Any response is highly appriciated.


what I suggest:

I convert the date/time in secs using following command:

perl -e 'use Time::Local; my $time = timelocal(SS,MM,HH,DD,MM,YYYY); printf $time'

and then compare it.

Parsing last update time for any file is done by me using 'awk' and 'cut' command.

But I need to know a way find the start time of a process so that I can parse the date as I had done with the file.

In Sort I want a command to know that gives me startup time of a process so that I can parse it and can use it with perl command show above.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.