Skip to content

Commit

Permalink
final commit for version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ColumPaget committed Mar 26, 2022
1 parent a594a55 commit 3f371fa
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 91 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ getlock [options] LockFilePath [LockFilePath] ... Program
-? this help
```

The flags -d -s -k and -K are positional, lockfiles given before them on the command line will not be affected, those after will be.
The flags -d -s -i -k and -K are positional, lockfiles given before them on the command line will not be affected, those after will be.

-k and -K only work if the lock file owner has written their pid into the lockfile. Writing the pid is the default behavior, but -s prevents it, and getlock will also refuse to write into files bigger than 20 bytes, as they are too big to only contain a Process ID
-k and -K only work if the lock file owner has written their pid into the lockfile. Writing the pid is the default behavior, but -s prevents it. Similarly -i uses a date written to the lock file, and so will also not work with -s. getlock will also refuse to write into files bigger than 25 bytes, as they are too big to only contain a Process ID and timestamp.


RUN INTERVAL
============

The `-i` option prevents a command from running until a timeout has expired. It uses the date stored in the lock file, along with the interval specified on the command-line. The command will only run when the time goes past this combined value. However, the run command MUST RETURN AN EXIT STATUS OF 0. For any other exit status it is assumed the command failed, and the wait interval is cancelled by deleting any lockfiles that the -d option was specified for.
The `-i` option prevents a command from running until a timeout has expired. It uses the date stored in the lock file, along with the interval specified on the command-line. The command will only run when the time goes past this combined value. However, the run command MUST RETURN AN EXIT STATUS OF 0. For any other exit status it is assumed the command failed, and the wait interval is cancelled by deleting any lockfiles that the -i option was specified before. In this manner `-i` is positional like `-d`, and specifies lockfiles to be deleted if the run command fails.

The `-i` option accepts a suffix of 'm' for minutes, 'h' for hours or 'd' for days. Without a suffix, it assumes the value is seconds.

Expand Down Expand Up @@ -159,7 +159,7 @@ getlock -N -w -t 10 -b file1.lck


```
getlock -i 5d -d /var/locks/backup.lck "tar -zcO mydir | ssh backuphost 'tar -zxf -'"
getlock -i 5d /var/locks/backup.lck "tar -zcO mydir | ssh backuphost 'tar -zxf -'"
```
Only run the command if we get a lock on /var/locks/backup.lck and command has not run for 5 days. Note the use of the `-d` flag to ensure that, if the command fails to run (ssh returns something other than 0) the lockfile will be deleted so the command can be tried again and again until it suceeds.

Expand Down
79 changes: 51 additions & 28 deletions config.log
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ ./configure
$ ./configure --with-libuseful=yes

## --------- ##
## Platform. ##
## --------- ##

hostname = hplap
uname -m = x86_64
uname -r = 5.15.3-64
hostname = beast
uname -m = i686
uname -r = 5.6.5-64
uname -s = Linux
uname -v = #3 SMP Fri Nov 19 20:22:35 GMT 2021
uname -v = #6 SMP Sun Apr 19 22:31:45 BST 2020

/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/uname -X =

/bin/arch = unknown
/usr/bin/arch -k = unknown
Expand All @@ -27,6 +27,7 @@ uname -v = #3 SMP Fri Nov 19 20:22:35 GMT 2021
/usr/bin/oslevel = unknown
/bin/universe = unknown

PATH: /home/colum/bin
PATH: /usr/prebin
PATH: /usr/local/bin
PATH: /usr/bin
Expand All @@ -39,28 +40,49 @@ PATH: /opt/Drawing/bin
PATH: /opt/FLTK/bin
PATH: /opt/GTK/bin
PATH: /opt/LibreCAD/bin
PATH: /opt/Python-3.5.6/bin
PATH: /opt/Python-3.7.1/bin
PATH: /opt/Qt5/bin
PATH: /opt/SDL/bin
PATH: /opt/SDL2/bin
PATH: /opt/blender-2.79b/bin
PATH: /opt/boinc_client-7.14.2/bin
PATH: /opt/brlcad-7.26.4/bin
PATH: /opt/chess/bin
PATH: /opt/crosstools-ng/bin
PATH: /opt/games/bin
PATH: /opt/ghostscript-9.22/bin
PATH: /opt/git-2.16.2/bin
PATH: /opt/gdbm-1.18.1/bin
PATH: /opt/ghostscript-9.26/bin
PATH: /opt/gifprogs-5.1.2/bin
PATH: /opt/git-2.20.1/bin
PATH: /opt/graphviz-2.40.1/bin
PATH: /opt/jpegprogs-9c/bin
PATH: /opt/llvm-6.0.1/bin
PATH: /opt/lua-5.3.4/bin
PATH: /opt/mujs-1.0.3/bin
PATH: /opt/luajid-2.0.4/bin
PATH: /opt/mingw32/bin
PATH: /opt/mono-5.20.1.27/bin
PATH: /opt/mozjs-24.2.0/bin
PATH: /opt/mujs-1.0.5/bin
PATH: /opt/netpbm-10.66.02/bin
PATH: /opt/opengl/bin
PATH: /opt/openjdk-15.0.2/bin
PATH: /opt/openjdk-8u262-b10/bin
PATH: /opt/panda3d/bin
PATH: /opt/perl-5.24.1/bin
PATH: /opt/qemu-5.2.1_SDL/bin
PATH: /opt/ruby-2.5.0/bin
PATH: /opt/php-7.1.3/bin
PATH: /opt/pngprogs-1.6.30/bin
PATH: /opt/qemu-5.2.0-aio/bin
PATH: /opt/ruby-2.5.2/bin
PATH: /opt/rust-1.57.0/bin
PATH: /opt/schily/bin
PATH: /opt/tcl-8.6.8/bin
PATH: /opt/timekeeper/bin
PATH: /opt/samba-4.8.1/bin
PATH: /opt/sound-studio/bin
PATH: /opt/squirrel-3.0/bin
PATH: /opt/tcl-8.6.9/bin
PATH: /opt/tiffprogs-4.0.8/bin
PATH: /opt/tinyscheme-1.41/bin
PATH: /opt/wine-6.0/bin
PATH: /opt/x86_64-unknown-linux-gnu/bin
PATH: /opt/xboinc_client-7.14.2/bin


## ----------- ##
Expand All @@ -72,28 +94,29 @@ configure:1915: found /usr/bin/gcc
configure:1926: result: gcc
configure:2155: checking for C compiler version
configure:2164: gcc --version >&5
gcc (GCC) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
gcc (GCC) 12.0.0 20220109 (experimental)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2175: $? = 0
configure:2164: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/8.1.0/lto-wrapper
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/12.0.0/lto-wrapper
Target: i486-pc-linux-gnu
Configured with: ../gcc-8.1.0-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-languages=c,c++,go --disable-nls --disable-multilib
Configured with: ../gcc-12-20220109/configure --enable-languages=c,c++,go --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-multilib --target=i486-pc-linux-gnu --build=i486-pc-linux-gnu --host=i486-pc-linux-gnu
Thread model: posix
gcc version 8.1.0 (GCC)
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20220109 (experimental) (GCC)
configure:2175: $? = 0
configure:2164: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: error: unrecognized command-line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2175: $? = 1
configure:2164: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2175: $? = 1
Expand Down Expand Up @@ -138,8 +161,8 @@ configure:2807: gcc -E conftest.c
configure:2807: $? = 0
configure:2821: gcc -E conftest.c
conftest.c:9:10: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
9 | #include <ac_nonexistent.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
configure:2821: $? = 1
configure: failed program was:
Expand All @@ -157,8 +180,8 @@ configure:2866: gcc -E conftest.c
configure:2866: $? = 0
configure:2880: gcc -E conftest.c
conftest.c:9:10: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
9 | #include <ac_nonexistent.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
configure:2880: $? = 1
configure: failed program was:
Expand Down Expand Up @@ -198,11 +221,11 @@ generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_COMMANDS =
$ ./config.status

on hplap
on beast

config.status:727: creating Makefile
configure:4381: === configuring in libUseful-4 (/home/colum/getlock/libUseful-4)
configure:4444: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local' --cache-file=/dev/null --srcdir=.
configure:4444: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local' '--with-libuseful=yes' --cache-file=/dev/null --srcdir=.

## ---------------- ##
## Cache variables. ##
Expand Down
4 changes: 2 additions & 2 deletions config.status
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ $config_files
Report bugs to the package provider."

ac_cs_config=""
ac_cs_config="'--with-libuseful=yes'"
ac_cs_version="\
config.status
configured by ./configure, generated by GNU Autoconf 2.69,
Expand Down Expand Up @@ -496,7 +496,7 @@ if $ac_cs_silent; then
fi

if $ac_cs_recheck; then
set X /bin/sh './configure' $ac_configure_extra_args --no-create --no-recursion
set X /bin/sh './configure' '--with-libuseful=yes' $ac_configure_extra_args --no-create --no-recursion
shift
$as_echo "running CONFIG_SHELL=/bin/sh $*" >&6
CONFIG_SHELL='/bin/sh'
Expand Down
Loading

0 comments on commit 3f371fa

Please sign in to comment.