help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Self terminating code for bash scripts


From: adrelanos
Subject: Re: [Help-bash] Self terminating code for bash scripts
Date: Tue, 19 Mar 2013 15:38:17 +0000

Greg Wooledge:
> On Tue, Mar 19, 2013 at 02:56:15PM +0000, adrelanos wrote:
>> When I am running a script, I wish, that it kills any previous instances
>> of itself in case it is still running. How can I do that?
> 
> Are you sure you want to kill already-running instances, rather than
> simply exiting to let them continue running without interference?

Yes.

> There's some discussion here:
> 
> http://mywiki.wooledge.org/ProcessManagement#How_do_I_make_sure_only_one_copy_of_my_script_can_run_at_a_time.3F

Interesting. I'll keep that in mind, will be helpful for me later.

> But it mostly deals with using locks to detect an already-running instance
> so that you can gracefully exit -- not kill the other guy.
> 
> Can you tell us what you're actually trying to do?

In general I get your point, which is valid. Perhaps I am doing a very
corner case. A script is checking some stuff (mostly versioning checks
form web). In case it was already run automatically, it adds a delay
before running the checks. If the user decides to run it right away, the
old script and therefore the delay gets terminated and the checks
immediately being.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]