Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Simultaneous execution of a "single minded" executable...

Simultaneous execution of a "single minded" executable...

Simultaneous execution of a "single minded" executable...

Here is my situation:

I have a VBScript that, among many other things, is creating a batch file that contains an execution of gtar to uncompress a tar file.

This VBScript is executed when a certain file is present in a directory. Execution is not the problem unless this script is kicked off simultaneously at the same time by two different automating tasks.

The automating task is looking for a specific file respective to a client in their directory. There are approximately 100 tasks that look for files in their respective client's directories that execute at random times throughout every day.

Once in a great blue moon, 2 tasks will kick off at the exact same time, which they will then both go through their script and will try to use gtar at the same time to uncompress their respective files.

Gtar does not agree with simultaneous execution and therefore procedes to uncompress only one of the files, or possibly both at the same time, and in doing so, "mish-moshes" the uncompressed files in one or both of the client's directories, thus causing a mess for me to clean up.

I have tried to implement a randomizing equation(s) to give me a value to use for a sleep command to offset the execution of gtar but there is still a remote chance that they will still execute the script at the same time, giving the same random number and still executing gtar at the same time.

I have tried Winzip's command line interface but it does not support uncompressing .tgz files.

The version of gtar I am utilizing is 1.12. I looked for a windows exe of 1.14, but was unable to find it.

The machine is a Dual P4 Xeon 3.06, 4 GB Ram, plenty o' hard drive space and running on Win 2k3 that is up to date.

Is there another way to:
- Uncompress each of the files automatically using third party software other than gtar?
- another course of action I should be looking at?

Any help is greatly appreciated.

RE: Simultaneous execution of a "single minded" executable...

What you can do it write a signature file before untarring (holding onto a handle for the signature file), and when you're done you delete the signature file.  You'd check to see if the signature file got created without error - if you weren't able to create it, that meant that another process was holding onto it's handle to the file, and you know that another process was in the middle of running gtar.

By holding onto the handle, should gtar die, or the vbscript die, the handle will be released by the OS, and the next time another script runs it will overwrite the file without any errors.

Chip H.

If you want to get the best response to a question, please read FAQ222-2244 first

RE: Simultaneous execution of a "single minded" executable...

Hi Chiph,

Thanks for responding!

If the file was in the process of using gtar, this "lockfile" would work just fine to keep the other process from processing at the same time.


The problem comes in when 2 files, are trying to use gtar at the same time. They both would try to create that signature file, but they cannot do that at the same time, and in creating that lockfile at the same time, they would probably both error out. I am going to code an example up and see what the results would be as I am interested to know the results. Will post results for all to see as well.

Thanks Chiph!

RE: Simultaneous execution of a "single minded" executable...

Which is worse?  Having one fail, or have them both run, with the results intermingled?

Chip H.

If you want to get the best response to a question, please read FAQ222-2244 first

RE: Simultaneous execution of a "single minded" executable...

There are 2 things I don't understand.
1. Why can you use logic (not really code) as presented below?
2. Why is this thread in an API forum?


if lockfile does not exist
 make lockfile

if lockfile is not available
 loop until timeout setting or file is available
 end loop

if didn't timeout
 lock lockfile
  do stuff
 unlock lockfile

carry on

RE: Simultaneous execution of a "single minded" executable...

Thank you for the response, Brian.

I have solved this problem by going with another 32 bit compressing application and adding in some lockfile and waiting sequence logic.

I was not sure where to put this problem so I put it in here trusting a moderator to move where appropriate.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close