AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-27-2008, 08:10 AM
|
#1
|
|
LQ Newbie
Registered: May 2008
Posts: 10
Rep:
|
how to save output of 'fuser' to a file
Hi,
I am trying to create a shell script for checking whether a file is being used by any process. If file is not being used by any process and I want to compress or gzip that file. I want to do this for compressing mount space.
The problem I am facing is, when I do
find . -name "*req" -size +10000 -exec fuser {} \; >> spoolfile.txt
The output of fuser is not saving the spoolfile. Instead its displaying on Standard Output
Can anybody help on this.
Thanks,
Raj
|
|
|
|
05-27-2008, 08:41 AM
|
#2
|
|
LQ Veteran
Registered: Sep 2003
Location: the Netherlands
Distribution: lfs, debian, rhel
Posts: 8,709
|
Hi,
The redirection part (>> spoolfile.txt) is placed wrong. It should be:
find . -name "*req" -size +10000 -exec fuser {} >> spoolfile.txt \;
The redirection is part of the fuser statement, not find.
Hope this helps.
|
|
|
|
05-27-2008, 10:40 AM
|
#3
|
|
LQ Newbie
Registered: May 2008
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by druuna
Hi,
The redirection part (>> spoolfile.txt) is placed wrong. It should be:
find . -name "*req" -size +10000 -exec fuser {} >> spoolfile.txt \;
The redirection is part of the fuser statement, not find.
Hope this helps.
|
#########
Hi druuna,
Thanks for your reply.
but still the same issue. The output is not saved in the spool file. I used command like given below.
find . -name "*req" -size +10000 -exec fuser {} >> spoolfile.txt \;
Pls help.
Thanks,
Raju. Payannavar
|
|
|
|
05-28-2008, 02:55 AM
|
#4
|
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Ubuntu, OL
Posts: 9,311
|
Try that:
Code:
find . -name "*req" -size +10000 -exec fuser {} + >> spoolfile.txt 2>&1
|
|
|
|
05-28-2008, 03:55 AM
|
#5
|
|
Moderator
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.4 OpenSuSE 12.2
Posts: 9,897
|
I didn't aware you double posted! Look at your duplicate thread for the answer (before it's closed) and consider jlliagre suggestion.
|
|
|
|
05-31-2008, 04:18 AM
|
#6
|
|
LQ Newbie
Registered: May 2008
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by jlliagre
Try that:
Code:
find . -name "*req" -size +10000 -exec fuser {} + >> spoolfile.txt 2>&1
|
++++++++++++++++++
Thanks a Million. It working as I expected.
Regards,
Raju Payannavar
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:06 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|