Shell

Hello I would be grateful if I get some help for my homework.

  1. The problem:
    I need to write a supervisory program, for which is given a
    directory name and a character string as parameters.
    The program have to watch in half minutes the changes in files which names start with that string, and are located in the given directory its subdirectories too.
    Under changes I mean :
    if the files rights have changed
    if the files last access time changed
    if the files last modification time changed
    I have to write these changes in a new file in this way:

(file name - change type - old value -> new value (date and time))
And finally in every 5 minutes I have screen the changes also on the monitor.

2.) shell script

3.) I'm not able to come up with a solution, I made the parameters-check and the delay with the sleep command, but I don't know how can I cut from ex. the outcomeing of stat command the dates and rights wich changes. I have to make a current database every time?

4.)Universitatea Babes Bolyai Facultatea de Matematica si Informatica, Cluj-Napoca,Romania,Robu Judit(the course is in Hungarian, so i figure it's useless to post a link here)

What shell are you using? What OS?

If you have any of these commands on your school UNIX, they will get you started:
stat, inotify -- easily.

Otherwise this sounds like your prof want you to learn about ls -ltc, ls -lt, and so on.

Get on there and find out which commands (you may have all of them) you can use.
ls is the easiest to use straight off, but requires lots of parsing output...

1 Like

Break the assignment into parts. Try to solve the first part, and (using code tags) post your best attempt, and what is happening (or not happening :)).

1 Like