On 12/04/2015 05:29 AM, Frédéric Bron wrote:
in fact, I just had to delete the .lock file. I do not understand why
it was there.

Many commands create a lock file so that you can't run multiple copies
of the command simultaneously. If you had two users running that
command, both writing to the shadow file, you could easily corrupt it.

The downside to lockfiles is if you interrupt the command somehow
(CTRL-C, sigint, whatever), it may terminate without cleaning up its
lock file first (poor programming, but it often happens). Future runs
of the command are denied because the lock file is present and the
command assumes another copy of itself is already running.

Example in shell script:

    if [ -e /tmp/lockfile ]; then
        echo "Lockfile found, exiting"
        exit 1
    fi

    touch /tmp/lockfile
    (do stuff)
    rm -f /tmp/lockfile
    exit 0

To make sure the lockfile gets deleted, you must create a function
that deletes the lockfile, and specify that function in a trap call
to trap SIGINT, SIGTERM, etc. That way it cleans up after itself if
you abort it.

You get the idea.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ri...@alldigital.com -
- AIM/Skype: therps2        ICQ: 226437340           Yahoo: origrps2 -
-                                                                    -
-     Try to look unimportant.  The bad guys may be low on ammo.     -
----------------------------------------------------------------------
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to