Skip to main content
Brian Paige
Participating Frequently
Jan 14, 2021 9:00 AM UTC

Universe File COPY

Have the monitoring program use the unix 'fuser' command on each file it checks.  If the command returns a PID, then another process (the copying process) still has the file open.

 

We use the '-o' option, but we're running AIX so options might be a little different on Linux.

 

Brian Paige

 

    7 replies

    New Participant
    Jan 15, 2021 9:09 AM UTC

    Have the monitoring program use the unix 'fuser' command on each file it checks.  If the command returns a PID, then another process (the copying process) still has the file open.

     

    We use the '-o' option, but we're running AIX so options might be a little different on Linux.

     

    Brian Paige

     

    Thanks I will try that.

    ------------------------------
    Sandy Barry
    ARAMARK
    ------------------------------
    Brian Paige
    Participating Frequently
    Jan 19, 2021 10:46 AM UTC
    Thanks I will try that.

    ------------------------------
    Sandy Barry
    ARAMARK
    ------------------------------

    Also – and my apologies for not thinking about this until now, but have you looked into using Samba shares?  That would eliminate the need for the monitoring/copying process.

     

    Brian Paige

     


    Participating Frequently
    Jan 19, 2021 11:04 AM UTC

    Also – and my apologies for not thinking about this until now, but have you looked into using Samba shares?  That would eliminate the need for the monitoring/copying process.

     

    Brian Paige

     


    If you are running the copy from a basic program you can use the LOCK feature and UNLOCK.
    Example
       LOCK 1 THEN
          *** YOU CODE TO COPY THE FILE 
          UNLOCK 1
       END

    The LIST.LOCKS command from TCL will show that LOCK 1 is set and once the copy is done then it removed the lock. If the lock is already set then it will do nothing.


    ------------------------------
    Kathleene Hunter
    Consultant
    Resolution Provider LLC
    ------------------------------
    New Participant
    Jan 19, 2021 12:41 PM UTC

    Also – and my apologies for not thinking about this until now, but have you looked into using Samba shares?  That would eliminate the need for the monitoring/copying process.

     

    Brian Paige

     


    Hi Brian- we currently use samba shares and we are trying to eliminate them. Our security team does not approve of them.  So we have hundreds of files sitting on samba shares that we will be transferring to windows servers using an automated FTP program.

    ------------------------------
    Sandy Barry
    ARAMARK
    ------------------------------
    New Participant
    Jan 19, 2021 1:17 PM UTC
    If you are running the copy from a basic program you can use the LOCK feature and UNLOCK.
    Example
       LOCK 1 THEN
          *** YOU CODE TO COPY THE FILE 
          UNLOCK 1
       END

    The LIST.LOCKS command from TCL will show that LOCK 1 is set and once the copy is done then it removed the lock. If the lock is already set then it will do nothing.


    ------------------------------
    Kathleene Hunter
    Consultant
    Resolution Provider LLC
    ------------------------------
    Hi Kathleen-  we have hundreds of programs that do the copy to a shared drive, our goal is not to have to change those programs.  We have one new program scanning for new files and ftping them to a windows server.   I need the scan program to be the one to check if a file is complete before the ftp.

    ------------------------------
    Sandy Barry
    ARAMARK
    ------------------------------
    Participating Frequently
    Jan 19, 2021 2:44 PM UTC
    Hi Kathleen-  we have hundreds of programs that do the copy to a shared drive, our goal is not to have to change those programs.  We have one new program scanning for new files and ftping them to a windows server.   I need the scan program to be the one to check if a file is complete before the ftp.

    ------------------------------
    Sandy Barry
    ARAMARK
    ------------------------------
    Okay then check the file for the end-of-data marker. If there then the file is complete, otherwise it's still coping the data using ftp.

    ------------------------------
    Kathleene Hunter
    Consultant
    Resolution Provider LLC
    ------------------------------
    Mar 1, 2021 9:29 AM UTC
    Hi Brian- we currently use samba shares and we are trying to eliminate them. Our security team does not approve of them.  So we have hundreds of files sitting on samba shares that we will be transferring to windows servers using an automated FTP program.

    ------------------------------
    Sandy Barry
    ARAMARK
    ------------------------------
    If overwriting existing files, please check both the source and target files are not in use beforehand and ensure they remain unused for the duration of the copy. As options:

    • Modify the file permissions - whether POSIX or ACLS - to ensure exclusive access for the duration.
    • Alternatively rename the relevant sub-directory structure temporarily - after checking with "fuser" before the rename and again afterwards to be certain.

    If using UniVerse 12, please be sure to review the 'uvunload' command as well to ensure any files copied or moved at the O/S level are unloaded from the System Buffer beforehand.

    ------------------------------
    John Jenkins
    Principal Technical Support Engineer
    Rocket Software Limited
    U.K.
    ------------------------------