Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help on writing a script that will generate information

Status
Not open for further replies.

Jukai

IS-IT--Management
Oct 16, 2006
1
0
0
US
Hey... I got assigned to write a unix script (using Bash or AWK... neither which I'm remotely good at) that will generate a report listing the directory, owner, last access time, and message about the change of any file in the directory (or its subdirectories) /home/... and this script should male the report to Admin every morning at 6, except for Saturdays and Sundays....

I would appreciate someone to actually write me a short working scripts, but if you could just even give me helpful hints or point me in the right direction, good lord that would be appreciated. Thanks!
 
Look into the -mtime option of the find command. Try writing the script yourself, and post here if you have any specific questions...

Annihilannic.
 
We are not here to do your work for you (unless you are willing to share your wages); We will however assist you in solving specific problems & pointing you in the right direction. Make a start and when you get stuck ask a question.

Pointers

1. man ls
2. man awk
3. man mailx
4. google for tripwire

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
Hi

Put this in crontab :
Code:
0 6 * * 2-5 find /home -ctime 1
0 6 * * 1 find /home -ctime 3
By default the output of processes runed by [tt]cron[/tt] is e-mailed to the owner. And by default all modifications change the file's change time.

If the output is not let to be e-mailed to the owner, you could do it "by hand" :
Code:
0 6 * * 2-5 find /home -ctime 1 | mail -s "Changed files at `date`" user@example.com
0 6 * * 1 find /home -ctime 3 | mail -s "Changed files at `date`" user@example.com
If you want to detect changes even if the file's change time was [tt]touch[/tt]ed, you have to verify the file checksum for example with [tt]md5sum[/tt]. That is abit longer, if you are interested in, and still have problem after [tt]man md5sum[/tt], then let us know.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top