1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-27 06:54:16 +01:00
yubikey-val/ykval-cron
Scott Sakai f24aed77a6
Fix what looks like a logic error in sync logic.
Only $req_answers sync peers would get polled.  When $req_answers is
less than $nr_servers, some servers (that return replayed counters)
will get ignored, since retrieveURLasync() stops after $req_answers
responses.

The fix requires $nr_servers responses from retrieveURLasync, causing
all sync peers to get polled and processed by sync().

This arrangement also allows a two-server sync pool to operate when
one peer is gone or unreachable, something that cannot be done before
these modifications.  Set the sync_level to 0, which means
"try everyone, but if you get no valid responses, it's okay to proceed".
Prior to the modifications, it means "don't even try syncing".

Also, added ykval-cron, which can be fired off from a cron job to
make sure ykval-queue stays running.  This is example code, as
your enviroment and usernames may differ.
2016-03-02 23:06:15 -08:00

23 lines
299 B
Bash
Executable File

#!/bin/bash
# Something to keep ykval-queue going
# run this in cron
# restarts if necessary
RUNAS=ykval
function start
{
su -s /bin/bash -c '/usr/sbin/ykval-queue &>/dev/null &' - ${RUNAS}
exit 0
}
FOUND=$( ps -C ykval-queue | wc -l )
if [[ ${FOUND} -lt 2 ]]; then
start
fi
exit 0