Table of Contents

SHELL

LOCK="/var/lock/${0##*/}.lck"

function sys_create_lock
{
    (ps -p $(readlink "${LOCK}")) &>/dev/null
    [ "$?" != "0" ] && rm -f "${LOCK}"
    ln -s $$ "${LOCK}" 2>/dev/null
    res="$?"
    [ "${res}" != "0" ] && exit "${res}"
    trap sys_remove_lock EXIT
}

function sys_remove_lock
{
    [ "$(readlink "${LOCK}")" == "$$" ] && rm -f "${LOCK}"
}

MISC

MORE

@related: bash arpalhands sync UnLock

@TaG: SynC CooP BaSh

<iframe width="420" height="315" src="http://www.youtube-nocookie.com/embed/m3hsJV_HZUk" frameborder="0" allowfullscreen></iframe>

lock.txt · Last modified: 2022/04/16 12:23 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki