Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Lightbulb check open file using lsof

    Hi all,

    I create following bash script part to check open files on my remote server.
    ssh -T $S_LOGIN <<EOI
    	open_File=`lsof +D /x01/files/scripts/ |grep -v "DIR"|wc -l`
    	echo "open file count : \$open_File"
        if ["$Open_File" -gt 1]; then
            echo "Warning:Folder have following open files"
    		lsof +D /x01/files/scripts |grep -v "DIR"
            echo "No Open files ";   	
    but here wc -l value not assign to $open_File variable it print as 0 (There are some open files in server ). please give some help for this or please give some proper way to check open files.
    Last edited by charith; 12-12-2011 at 05:34 PM. Reason: update

  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Western Kentucky
    $Open_File and $open_File are not the same variable
    linux user # 503963

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts