mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #3446 from holta/kiwix-simplify
Put Kiwix var {{ systemctl_program }} to rest — simple is almost always better
This commit is contained in:
commit
fa8d05bab3
3 changed files with 25 additions and 10 deletions
|
@ -57,6 +57,5 @@ kiwix_url: /kiwix
|
|||
kiwix_url_plus_slash: "{{ kiwix_url }}/" # /kiwix/
|
||||
kiwix_path: "{{ iiab_base }}/kiwix" # /opt/iiab/kiwix
|
||||
|
||||
systemctl_program: /bin/systemctl
|
||||
kiwix_nginx_timeout: 600
|
||||
kiwix_threads: 4
|
||||
|
|
|
@ -17,19 +17,35 @@
|
|||
when: kiwix_enabled
|
||||
|
||||
|
||||
# TO DO: BOTH CRON ENTRIES BELOW *SHOULD* BE DELETED "when: not kiwix_enabled"
|
||||
|
||||
# In the past kiwix-serve did not stay running, so we'd been doing this hourly.
|
||||
# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in
|
||||
# future, whenever service fails, if this really catches all cases??
|
||||
# https://github.com/iiab/iiab/issues/484#issuecomment-342151726
|
||||
- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu)
|
||||
lineinfile:
|
||||
# mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed
|
||||
line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service"
|
||||
dest: /etc/crontab
|
||||
|
||||
- name: Set cron to restart kiwix-serve 4AM daily, if kiwix_enabled
|
||||
cron:
|
||||
name: kiwix-serve daily restart
|
||||
minute: "0"
|
||||
hour: "4"
|
||||
job: /usr/bin/systemctl restart kiwix-serve.service
|
||||
user: root
|
||||
cron_file: kiwix-serve_daily # i.e. /etc/cron.d/kiwix-serve_daily instead of /var/spool/cron/crontabs/root or /etc/crontab
|
||||
when: kiwix_enabled
|
||||
|
||||
- name: Remove 4AM daily cron, if not kiwix_enabled
|
||||
cron:
|
||||
name: kiwix-serve daily restart
|
||||
cron_file: kiwix-serve_daily
|
||||
state: absent
|
||||
when: not kiwix_enabled
|
||||
|
||||
# - name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu)
|
||||
# lineinfile:
|
||||
# # mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed
|
||||
# line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service"
|
||||
# dest: /etc/crontab
|
||||
# when: kiwix_enabled
|
||||
|
||||
# - name: Make a crontab entry to restart kiwix-serve at 4AM (redhat)
|
||||
# # * * * * * user-name command to be executed
|
||||
# lineinfile:
|
||||
|
|
|
@ -25,12 +25,12 @@ if flock -n -e 200; then :
|
|||
else
|
||||
/usr/bin/iiab-make-kiwix-lib.py -f # force rebuild of library.xml
|
||||
fi
|
||||
{{ systemctl_program }} stop kiwix-serve
|
||||
/usr/bin/systemctl stop kiwix-serve
|
||||
if [ -f $KIWIXLIB ]; then
|
||||
rm $KIWIXLIB
|
||||
fi
|
||||
mv $KIWIXLIB.tmp $KIWIXLIB
|
||||
{{ systemctl_program }} start kiwix-serve
|
||||
/usr/bin/systemctl start kiwix-serve
|
||||
else
|
||||
echo "Can't get wait lock for iiab-make-kiwix-lib.py";
|
||||
exit 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue