mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
add concurrency to make kiwix lib
This commit is contained in:
parent
90abbdffa6
commit
051f5387dc
2 changed files with 22 additions and 5 deletions
|
@ -1,8 +1,25 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
{{ systemctl_program }} stop kiwix-serve
|
LOCK_PATH=/run/lock/kiwix
|
||||||
/usr/bin/iiab-make-kiwix-lib.py
|
WAITLOCK="$LOCK_PATH/make-kiwix-lib-wait.LCK";
|
||||||
#/usr/bin/iiab-make-apache-config.py
|
RUNLOCK=WAITLOCK="$LOCK_PATH/make-kiwix-lib-run.LCK";
|
||||||
{{ systemctl_program }} start kiwix-serve
|
exec 200>$WAITLOCK;
|
||||||
|
exec 201>$RUNLOCK;
|
||||||
|
|
||||||
|
if flock -n -e 200; then :
|
||||||
|
echo 'Waiting to run iiab-make-kiwix-lib.py'
|
||||||
|
# wait for up to 5 min
|
||||||
|
flock -x -w 300 201
|
||||||
|
echo "Now running iiab-make-kiwix-lib.py"
|
||||||
|
# write to {{ kiwix_library_xml }}.tmp to minimize kiwix down
|
||||||
|
# zim map could be out of sync for a few seconds
|
||||||
|
/usr/bin/iiab-make-kiwix-lib.py
|
||||||
|
{{ systemctl_program }} stop kiwix-serve
|
||||||
|
rm {{ kiwix_library_xml }}
|
||||||
|
mv {{ kiwix_library_xml }}.tmp {{ kiwix_library_xml }}
|
||||||
|
{{ systemctl_program }} start kiwix-serve
|
||||||
|
else
|
||||||
|
echo "Can't get wait lock for iiab-make-kiwix-lib.py";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -30,7 +30,7 @@ iiab_config_file = "{{ iiab_config_file }}"
|
||||||
# Variables that should be read from config file
|
# Variables that should be read from config file
|
||||||
# All of these variables will be read from config files and recomputed in init()
|
# All of these variables will be read from config files and recomputed in init()
|
||||||
iiab_zim_path = "{{ iiab_zim_path }}"
|
iiab_zim_path = "{{ iiab_zim_path }}"
|
||||||
kiwix_library_xml = "{{ kiwix_library_xml }}"
|
kiwix_library_xml = "{{ kiwix_library_xml }}.tmp"
|
||||||
|
|
||||||
iiab_base_path = "{{ iiab_base }}"
|
iiab_base_path = "{{ iiab_base }}"
|
||||||
kiwix_manage = iiab_base_path + "/kiwix/bin/kiwix-manage"
|
kiwix_manage = iiab_base_path + "/kiwix/bin/kiwix-manage"
|
||||||
|
|
Loading…
Reference in a new issue