From 5e89d9d31e945ecd3d21dddf9a5cf7a3151a6736 Mon Sep 17 00:00:00 2001 From: nemunaire Date: Thu, 20 Nov 2014 21:03:35 +0100 Subject: [PATCH] Use bash for Debian compat --- README.md | 2 +- backup.sh | 2 +- clear_cache.sh | 2 +- gen_site.sh | 2 +- launch.sh | 4 +++- launch_local.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ synchro.sh | 2 +- 7 files changed, 50 insertions(+), 6 deletions(-) create mode 100755 launch_local.sh diff --git a/README.md b/README.md index d8afcc29..cf6efbea 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ CONNTRACK states. * `mcrypt`; * `HTTP::Request::Common` perl module (provided by `libwww-perl`); * `Digest::Whirlpool` perl module (provided by `lib-digest-whirlpool-perl`); -* `Mcrypt` from CPAN (`cpan -i Mcrypt`, on Debian, it requires `libtool` and +* `Mcrypt` from CPAN (`cpan -i Mcrypt`, on Debian, it requires `libltdl-dev` and `build-essential`) to decrypt submissions (see https://metacpan.org/pod/Mcrypt); diff --git a/backup.sh b/backup.sh index 6b23f068..bfdfdee3 100755 --- a/backup.sh +++ b/backup.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # This script mades backup of important things diff --git a/clear_cache.sh b/clear_cache.sh index 5d3d5c2f..024aaf5e 100755 --- a/clear_cache.sh +++ b/clear_cache.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # This script deletes Onyx framework cache diff --git a/gen_site.sh b/gen_site.sh index 6ef98771..4fa11caf 100755 --- a/gen_site.sh +++ b/gen_site.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash BASEURL="localhost" SALT_TEAM="connected" diff --git a/launch.sh b/launch.sh index ed33db08..bf5f15ef 100755 --- a/launch.sh +++ b/launch.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # This script does all actions in backend production environment @@ -14,6 +14,8 @@ then exit $? fi +mkdir -p ./logs + touch ./logs/checks.log tail -f ./logs/checks.log & KP1=$! diff --git a/launch_local.sh b/launch_local.sh new file mode 100755 index 00000000..b86be2c2 --- /dev/null +++ b/launch_local.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# This script does all actions in backend local environment + +rm -f /tmp/stop +cd `dirname "$0"` + +source config.sh + +#if [ "$UID" = "0" ] +#then +# SCRIPT=`pwd`/`basename "$0"` +# su -c "sh $SCRIPT" "$SYNCHRO_USER" +# exit $? +#fi + +mkdir -p ./logs + +touch ./logs/checks.log +tail -f ./logs/checks.log & +KP1=$! + +TMPF=`mktemp` + +tail -f "$TMPF" | ./gen_site.pl -d -s /tmp/test.sock -bt /challenge/ -ba /challenge-admin/ -o ./out & +KP2=$! + +while ! [ -f /tmp/stop ]; +do + if [ `ls submission | wc -l` -gt 1 ] + then + ./clear_cache.sh top + ./check.pl 2>> ./logs/checks.log >> "$TMPF" + + else + sleep 1 + fi +done + +kill -9 $KP1 $KP2 + +rm -rf "$TMPF" diff --git a/synchro.sh b/synchro.sh index e6f81ce7..8cebbb6d 100755 --- a/synchro.sh +++ b/synchro.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # This script synchronizes first, the generated frontend and then # retrieves submissions