From ab82ed3fac9333bd4db925b2cfc435e3891e2f07 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Fri, 14 Sep 2018 10:33:07 +0200 Subject: [PATCH] LXCize cronjobs --- basic/srv/vm/mgr/confupdater.py | 2 +- ckan/setup/etc/periodic/hourly/ckan | 8 ++++---- kanboard/setup/etc/periodic/daily/kanboard | 5 +++-- seeddms/setup/etc/periodic/hourly/seeddms | 5 +++-- ushahidi/setup/etc/periodic/15min/ushahidi | 13 +++++++------ 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/basic/srv/vm/mgr/confupdater.py b/basic/srv/vm/mgr/confupdater.py index a9edd86..207d302 100644 --- a/basic/srv/vm/mgr/confupdater.py +++ b/basic/srv/vm/mgr/confupdater.py @@ -30,7 +30,7 @@ def run_mysql_query(query, database): maria_started = tools.is_service_started('mariadb') if not maria_started: tools.start_service('mariadb') - subprocess.run(['docker', 'exec', '-i', 'mariadb', 'mysql', '-e', query, database]) + subprocess.run(['lxc-attach', 'mariadb', '--', 'mysql', '-e', query, database]) if not maria_started: tools.stop_service('mariadb') diff --git a/ckan/setup/etc/periodic/hourly/ckan b/ckan/setup/etc/periodic/hourly/ckan index 00bb07e..3723b25 100755 --- a/ckan/setup/etc/periodic/hourly/ckan +++ b/ckan/setup/etc/periodic/hourly/ckan @@ -1,7 +1,7 @@ #!/bin/sh -# TODO -if docker ps | grep -q 'ckan$'; then - lxc-execute ckan -- paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini >/dev/null - lxc-execute ckan -- paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini >/dev/null +# TODO: -u 8003 -g 8003 ? +if [ -e /run/openrc/started/ckan ]; then + lxc-attach ckan -- paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini >/dev/null + lxc-attach ckan -- paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini >/dev/null fi diff --git a/kanboard/setup/etc/periodic/daily/kanboard b/kanboard/setup/etc/periodic/daily/kanboard index 621b905..27fd889 100755 --- a/kanboard/setup/etc/periodic/daily/kanboard +++ b/kanboard/setup/etc/periodic/daily/kanboard @@ -1,5 +1,6 @@ #!/bin/sh -if docker ps | grep -q 'kanboard$'; then - docker exec kanboard /srv/kanboard/cli cronjob >/dev/null +# TODO: -u 8009 -g 8009 ? +if [ -e /run/openrc/started/kanboard ]; then + lxc-attach kanboard -- /srv/kanboard/cli cronjob >/dev/null fi diff --git a/seeddms/setup/etc/periodic/hourly/seeddms b/seeddms/setup/etc/periodic/hourly/seeddms index abc9e6f..65be19f 100755 --- a/seeddms/setup/etc/periodic/hourly/seeddms +++ b/seeddms/setup/etc/periodic/hourly/seeddms @@ -1,5 +1,6 @@ #!/bin/sh -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 +# TODO: -u 8010 -g 8010 ? +if [ -e /run/openrc/started/seeddms ]; then + lxc-attach seeddms -- sh -c "cd /srv/seeddms/www/utils/; php indexer.php --config ../conf/settings.xml" >/dev/null fi diff --git a/ushahidi/setup/etc/periodic/15min/ushahidi b/ushahidi/setup/etc/periodic/15min/ushahidi index 4a23c13..70bed27 100755 --- a/ushahidi/setup/etc/periodic/15min/ushahidi +++ b/ushahidi/setup/etc/periodic/15min/ushahidi @@ -1,9 +1,10 @@ #!/bin/sh -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 - docker exec ushahidi sh -c 'cd /srv/ushahidi/platform && bin/ushahidi webhook send' >/dev/null +# TODO: -u 8014 -g 8014 ? +if [ -e /run/openrc/started/ushahidi ]; then + lxc-attach ushahidi -- sh -c 'cd /srv/ushahidi/platform; bin/ushahidi dataprovider outgoing' >/dev/null + lxc-attach ushahidi -- sh -c 'cd /srv/ushahidi/platform; bin/ushahidi dataprovider incoming' >/dev/null + lxc-attach ushahidi -- sh -c 'cd /srv/ushahidi/platform; bin/ushahidi savedsearch' >/dev/null + lxc-attach ushahidi -- sh -c 'cd /srv/ushahidi/platform; bin/ushahidi notification queue' >/dev/null + lxc-attach ushahidi -- sh -c 'cd /srv/ushahidi/platform; bin/ushahidi webhook send' >/dev/null fi