Professional Web Applications Themes

How to avoid writing files that is used by other programs? - PERL Beginners

I am writing a script to relocate some tar files in a folder. Since those tar files are scheduled to be written daily, I want to make sure I'm not moving any files which are being written by other programs... How can I do so? Thanks a lot!!!!...

  1. #1

    Default How to avoid writing files that is used by other programs?

    I am writing a script to relocate some tar files in a folder.

    Since those tar files are scheduled to be written daily,
    I want to make sure I'm not moving any files which are being
    written by other programs...

    How can I do so?

    Thanks a lot!!!!
    Shu Guest

  2. #2

    Default Re: How to avoid writing files that is used by other programs?

    Shu Hung wrote: 

    You can lock them.

    perldoc -f flock
    perldoc -q "lock a file"

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Guest

  3. #3

    Default Re: How to avoid writing files that is used by other programs?

    Nyimi Jose ) wrote: 
    >>
    >> You can lock them.
    >>
    >> perldoc -f flock
    >> perldoc -q "lock a file"[/ref]
    >
    > It seems that (from original post) there are 2 programs there:
    > Program1: writing the tar files
    > Program2: trying to relocate tar files created by program1
    >
    > My understanding is that the "lock" should be done by the program1
    > to avoid program2 relocate files untill it (program1) finishs
    > writting them.
    >
    > If the program1 is not under your control, how to use the "lock"
    > solution you suggested ?[/ref]

    You can't. Locking must be done by the "other programs" (which I
    assumed the OP is able to modify...).

    Thanks for pointing it out.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Guest

  4. #4

    Default Using "do" versus "use" for subroutine


    Hi,

    I would like to know which of this
    is better and what is the pro and cons:

    1. A file "mysub.pl" which stored
    a subroutine, and later called by
    main file using: do "mysub.pl"

    or

    2. A file "mysub.pm" and called
    in main file using : use "mysub.pm"

    Thanks so much for your time

    Regards,
    Edward WIJAYA
    SINGAPORE
    Edward Guest

Similar Threads

  1. Usual conventions writing network programs?
    By Darko in forum UNIX Programming
    Replies: 3
    Last Post: November 7th, 12:21 AM
  2. Use of find - avoid some type of files
    By JMartinez in forum Linux / Unix Administration
    Replies: 1
    Last Post: October 3rd, 02:26 PM
  3. Writing C stdio programs with drag and drop interface
    By David Phillip Oster in forum Mac Programming
    Replies: 4
    Last Post: July 13th, 04:47 PM
  4. avoid writing to log file on insert
    By Jed Ozone in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 2nd, 02:45 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139