From 883cfce04c152ae25356a38568e3aef15a145b05 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 9 Apr 2018 15:20:20 +0200 Subject: [PATCH] Check container status before running cron jobs --- ckan/etc/periodic/hourly/ckan | 6 ++++-- kanboard/etc/periodic/daily/kanboard | 4 +++- seeddms/etc/periodic/hourly/seeddms | 4 +++- ushahidi/etc/periodic/15min/ushahidi | 10 ++++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ckan/etc/periodic/hourly/ckan b/ckan/etc/periodic/hourly/ckan index b58e8dd..cfa910d 100755 --- a/ckan/etc/periodic/hourly/ckan +++ b/ckan/etc/periodic/hourly/ckan @@ -1,4 +1,6 @@ #!/bin/sh -docker exec ckan paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini >/dev/null -docker exec ckan paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini >/dev/null +if docker ps | grep -q 'ckan$'; then + docker exec ckan paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini >/dev/null + docker exec ckan paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini >/dev/null +fi diff --git a/kanboard/etc/periodic/daily/kanboard b/kanboard/etc/periodic/daily/kanboard index 005b7a1..621b905 100755 --- a/kanboard/etc/periodic/daily/kanboard +++ b/kanboard/etc/periodic/daily/kanboard @@ -1,3 +1,5 @@ #!/bin/sh -docker exec kanboard /srv/kanboard/cli cronjob >/dev/null +if docker ps | grep -q 'kanboard$'; then + docker exec kanboard /srv/kanboard/cli cronjob >/dev/null +fi diff --git a/seeddms/etc/periodic/hourly/seeddms b/seeddms/etc/periodic/hourly/seeddms index 5e9157d..abc9e6f 100755 --- a/seeddms/etc/periodic/hourly/seeddms +++ b/seeddms/etc/periodic/hourly/seeddms @@ -1,3 +1,5 @@ #!/bin/sh -docker exec seeddms "cd /srv/seeddms/www/utils/ && /usr/bin/php indexer.php --config ../conf/settings.xml" >/dev/null +if docker ps | grep -q 'seeddms$'; then + docker exec seeddms "cd /srv/seeddms/www/utils/ && /usr/bin/php indexer.php --config ../conf/settings.xml" >/dev/null +fi diff --git a/ushahidi/etc/periodic/15min/ushahidi b/ushahidi/etc/periodic/15min/ushahidi index cba71b6..6ff13a1 100755 --- a/ushahidi/etc/periodic/15min/ushahidi +++ b/ushahidi/etc/periodic/15min/ushahidi @@ -1,6 +1,8 @@ #!/bin/sh -docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi dataprovider outgoing' >/dev/null -docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi dataprovider incoming' >/dev/null -docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi savedsearch' >/dev/null -docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi notification queue' >/dev/null +if docker ps | grep -q 'ushahidi$'; then + docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi dataprovider outgoing' >/dev/null + docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi dataprovider incoming' >/dev/null + docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi savedsearch' >/dev/null + docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi notification queue' >/dev/null +fi