Use python instead of shell script, for datasync checks

seems to give more clarity, and we'll have more options this way
This commit is contained in:
Lance Edgar 2021-11-11 11:58:09 -06:00
parent 5b985fb803
commit b58c0da7a4
2 changed files with 59 additions and 32 deletions

View file

@ -1,20 +1,33 @@
#!/bin/sh #!${envroot}/bin/python
TIMEOUT="$1" import os
if [ "$TIMEOUT" = "" ]; then import sys
echo "Usage: check-datasync-queue TIMEOUT" import argparse
exit 3 import subprocess
fi
cd ${envroot}
bin/rattail -c app/quiet.conf --no-versioning datasync --timeout $TIMEOUT check 2>&1 def check_datasync_queue(timeout):
rc=$? os.chdir(sys.prefix)
if [ $rc -eq 1 ]; then
exit 2
elif [ $rc -ne 0 ]; then
echo "unknown issue"
exit 3
fi
exit 0 retcode = subprocess.call([
'bin/rattail',
'-c', 'app/${config}.conf',
'--no-versioning',
'datasync',
'--timeout', timeout,
'check',
])
if retcode == 1:
sys.exit(2)
elif retcode:
print("unknown issue")
sys.exit(3)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('timeout')
args = parser.parse_args()
check_datasync_queue(args.timeout)

View file

@ -1,20 +1,34 @@
#!/bin/sh #!${envroot}/bin/python
TIMEOUT="$1" import os
if [ "$TIMEOUT" = "" ]; then import sys
echo "Usage: check-datasync-watchers TIMEOUT" import argparse
exit 3 import subprocess
fi
cd ${envroot}
bin/rattail -c app/datasync.conf -c app/quiet.conf --no-versioning datasync --timeout $TIMEOUT check-watchers 2>&1 def check_datasync_queue(timeout):
rc=$? os.chdir(sys.prefix)
if [ $rc -eq 1 ]; then
exit 2
elif [ $rc -ne 0 ]; then
echo "unknown issue"
exit 3
fi
exit 0 retcode = subprocess.call([
'bin/rattail',
'-c', 'app/datasync.conf',
'-c', 'app/${config}.conf',
'--no-versioning',
'datasync',
'--timeout', timeout,
'check-watchers',
])
if retcode == 1:
sys.exit(2)
elif retcode:
print("unknown issue")
sys.exit(3)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('timeout')
args = parser.parse_args()
check_datasync_queue(args.timeout)