arfoll / unrarall

bash script to unrar everything and cleanup in a given directory
GNU General Public License v3.0
260 stars 68 forks source link

What happens if I run the command twice? #27

Closed ghost closed 8 years ago

ghost commented 8 years ago

If I run this command twice

/home/user/.script/unrarall -s --clean=all /source_parent_dir

Will the second run of the script not overlap the first command?

I'm thinking in the situation, where I want a cron job to run the command every 1 minute. The first run may still be processing when the second cron kicks off

ghost commented 8 years ago

I guess I can use http://linux.die.net/man/1/flock ... seems to be a better approach than implementing something in each individual program

https://ma.ttias.be/prevent-cronjobs-from-overlapping-in-linux/

delcypher commented 8 years ago

@meffect It's not safe to run multiple copies of unrarall at the same time. Using something like flock seems like a good idea as I don't want to add additional code to unrarall to detect for this.

ghost commented 8 years ago

Sounds good. Good to know it's not built in, so I can account for it