Add basic standard datasync check scripts

This commit is contained in:
Lance Edgar 2021-01-02 20:04:36 -06:00
parent 7500202af0
commit 70c5d661a3
3 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#!/bin/sh
TIMEOUT="$1"
if [ "$TIMEOUT" = "" ]; then
echo "Usage: check-datasync-queue TIMEOUT"
exit 3
fi
cd ${envroot}
bin/rattail -c app/quiet.conf --no-versioning datasync --timeout $TIMEOUT check 2>&1
rc=$?
if [ $rc -eq 1 ]; then
exit 2
elif [ $rc -ne 0 ]; then
echo "unknown issue"
exit 3
fi
exit 0

View file

@ -0,0 +1,20 @@
#!/bin/sh
TIMEOUT="$1"
if [ "$TIMEOUT" = "" ]; then
echo "Usage: check-datasync-watchers TIMEOUT"
exit 3
fi
cd ${envroot}
bin/rattail -c app/datasync.conf -c app/quiet.conf --no-versioning datasync --timeout $TIMEOUT check-watchers 2>&1
rc=$?
if [ $rc -eq 1 ]; then
exit 2
elif [ $rc -ne 0 ]; then
echo "unknown issue"
exit 3
fi
exit 0

View file

@ -75,3 +75,16 @@ def disable_emails(c, dbname):
Disable all emails for the given database.
"""
postgresql.sql(c, "update setting set value = 'false' where name like 'rattail.mail.%.enabled';", database=dbname)
def deploy_datasync_checks(c, envroot, **kwargs):
"""
Deploy the standard datasync (queue, watcher) check scripts.
"""
envroot = envroot.rstrip('/')
context = kwargs.pop('context', {})
context['envroot'] = envroot
deploy(c, 'rattail/check-datasync-queue.mako', '{}/app/check-datasync-queue'.format(envroot),
context=context, **kwargs)
deploy(c, 'rattail/check-datasync-watchers.mako', '{}/app/check-datasync-watchers'.format(envroot),
context=context, **kwargs)