-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
lfmergeqm-looping.sh
16 lines (12 loc) · 749 Bytes
/
lfmergeqm-looping.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
# Catch SIGTERM and exit cleanly
trap "exit" TERM
# This is also handled in entrypoint.sh, but since entrypoint.sh uses exec to run this script, we need to handle SIGTERM here as well
# Run lfmergeqm every time a file is created in the sync queue
# We use the close_write event because the create event can be fired before the file's contents are written, and then `lfmergeqm` can run too early
# This is expected to run as the CMD, launched by the entry point.
while inotifywait -e close_write /var/lib/languageforge/lexicon/sendreceive/syncqueue; do
sudo -H -u www-data lfmergeqm
# Run it again just to ensure that any initial clones that missed a race condition have a chance to get noticed
sudo -H -u www-data lfmergeqm
done