9.11 Viewing Open Files for an NCP Server Connection, and Closing a Specific Open File

You might want to close a specific open file for the following reasons:

  • A file in a shared storage are has been held open for a very long time. The application that is being used (such as Microsoft Word or OpenOffice) has locked the file for write access to other users.

  • You know which user has the file open, and the user is not available to close the file, or cannot close the file.

  • The user has multiple files open.

  • You want to close only one of the files.

To use NCPCON to view the list of open files for a connection, then close a specific open file:

  1. Open a terminal console, then log in as the root user.

  2. At the console prompt, enter the following command to get a list of NCP connections for a given file:

    ncpcon files list f=filename
    

    Replace filename with the Linux path for the file, including the filename, such as /media/nss/VOL1/Document.rtf.

    For example, the following response shows that the admin user in connection 15 has a lock held open on the file:

    # ncpcon files list f=/media/nss/VOL1/Document.rtf 
    
    ... Executing " files list f=/media/nss/VOL1/Document.rtf"
    
    Connection  User Name            Rights
    15      .CN=admin.O=novell.T=SUMMER. 0x9
    
    Count of locks found on the file /media/nss/VOL1/Document.rtf: 1.
    
    ... completed OK [elapsed time = 1 Second 4294051 msecs 640 usecs]
    
    
  3. Visually confirm that you have the correct file and connection.

  4. Enter the following command to close the open file by filename:

    ncpcon files close f=filename
    

    For example:

    ncpcon files close f=/media/nss/VOL1/Document.rtf 
    

    You can alternatively specify the connection number to close all open files for that connection, including the filename of interest.

    ncpcon files close c=connection_number
    

    For example:

    ncpcon files close c=15
    
  5. Verify that any temporary file that the application opened for the file has been removed from the folder by the application. Otherwise, the user might not be able to save changes to the file of interest.

    1. In Novell Remote Manager, select Managing NCP Services > Manage Shares.

    2. Click the volume’s name link, then navigate the directory structure to the folder where the open file was located.

    3. Use the Search feature to find a temporary file for the open file, such as ~$myfile.doc or .~lock.myfile.odt.

    4. Click the File Information icon next to the file name.

    5. On the File Information page, click Delete File.

      For more information about temporary files created by an application, see Step 5 in Section 9.10, Viewing Open Files for an NCP Server Connection, and Closing All Open Files.