![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help needed in fuser command | anju | Shell Programming and Scripting | 1 | 02-20-2008 02:08 AM |
| redirect stderr and/or stdout to /dev/null from command line | knc9233 | UNIX for Dummies Questions & Answers | 1 | 01-25-2007 12:24 PM |
| problem with redirect stdout to file | mlucas | UNIX for Advanced & Expert Users | 3 | 12-06-2006 10:53 AM |
| Redirect stdout & stderr and append to a file | Santi | Shell Programming and Scripting | 2 | 01-02-2006 07:58 PM |
| Redirect stdout and stderr | zcurtis | Shell Programming and Scripting | 8 | 09-02-2002 07:13 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi all,
I have the following script: ------------------------------------------------- #SCRIPT TO CHECK WHO HAS ACCESSED THE LOG/FILE IN PAST 'N' MINUTES, AND MAIL ACCORDINGLY. MYPATH="/clocal/mqbrkrs/user/mqsiadm/sanjay/" MAIL_RECIPIENTS="vg517@dcx.com" Subject="File accessed in last few minutes are ::" >tempmail.txt >tempfind.txt ## List all the files which one accessed since last 1 min ##### for file_dir in `find $MYPATH -amin -1` do ### Find out the PID for that files which one been accessed echo `fuser -uf "$file_dir" | tr -dc "[:digit:]" ` 1>> tempmail.txt echo " $file_dir is being accessed" >> tempmail.txt done cat tempmail.txt | mailx -s "$Subject" "$MAIL_RECIPIENTS" ------------------------------------------------- fuser command returns process id, to the file "tempmail.txt" and also prints the output to the STDOUT., both the outputs are different. output to the file tempmail.txt : ----------------------------------------------- 335936 /clocal/mqbrkrs/user/mqsiadm/sanjay/ is being accessed 594010880672541182872816 /clocal/mqbrkrs/user/mqsiadm/sanjay/AccessMonitor is being accessed 541182 /clocal/mqbrkrs/user/mqsiadm/sanjay/AccessMonitor/AccessLogMonitor_script is being accessed ---------------------------------------------- output to the STDOUT :---------------------------------------------- /clocal/mqbrkrs/user/mqsiadm/sanjay/: c(mqsiadm) /clocal/mqbrkrs/user/mqsiadm/sanjay/AccessMonitor: c(mqsiadm)c(mqsiadm)c(mqsiadm)c(mqsiadm) /clocal/mqbrkrs/user/mqsiadm/sanjay/AccessMonitor/AccessLogMonitor_script: (mqsiadm) ----------------------------------------------- I WANT the output of STDOUT should be present in file tempmail.txt. In the script i have done `command 1>> filename` but its not working. Please give me the solution to this. Thanks a lot. Varun |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|