From 24c4d7ed9ed1669e6deec758f98140e0b9187a55 Mon Sep 17 00:00:00 2001 From: Alec Muffett Date: Sun, 10 Nov 2019 13:07:30 +0000 Subject: [PATCH] commit: first cut --- eotk | 5 +++++ lib.d/do-configure.pl | 2 +- templates.d/cleanup.sh.txt | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 templates.d/cleanup.sh.txt diff --git a/eotk b/eotk index a98bdf8..1436ca2 100755 --- a/eotk +++ b/eotk @@ -448,6 +448,11 @@ case "$cmd" in InvokeRemotely debugoff "$@" ;; + cleanup) # project ..., or "-a" + $need_to_run_locally && RunLocallyOverProjects cleanup "$@" + InvokeRemotely cleanup "$@" + ;; + syntax) # project ..., or "-a" $need_to_run_locally && RunLocallyOverProjects syntax "$@" InvokeRemotely syntax "$@" diff --git a/lib.d/do-configure.pl b/lib.d/do-configure.pl index 75b2794..f69218b 100755 --- a/lib.d/do-configure.pl +++ b/lib.d/do-configure.pl @@ -625,7 +625,7 @@ foreach my $var (@set_blank) { &SetEnv($var, ""); } -&SetEnv("SCRIPT_NAMES", "bounce.sh debugoff.sh debugon.sh harvest.sh maps.sh nxreload.sh start.sh status.sh stop.sh syntax.sh torreload.sh"); +&SetEnv("SCRIPT_NAMES", "bounce.sh cleanup.sh debugoff.sh debugon.sh harvest.sh maps.sh nxreload.sh start.sh status.sh stop.sh syntax.sh torreload.sh"); &SetEnv("SCRIPT_PAUSE", 5); # dynamic settings: overridable / may be given a global setting diff --git a/templates.d/cleanup.sh.txt b/templates.d/cleanup.sh.txt new file mode 100644 index 0000000..2940058 --- /dev/null +++ b/templates.d/cleanup.sh.txt @@ -0,0 +1,29 @@ +#!/bin/sh +# eotk (c) 2017 Alec Muffett +cd %PROJECT_DIR% || exit 1 + +# stop everything to be sure + +sh %PROJECT_DIR%/stop.sh || exit 1 + +# remove pidfiles + +%%IF %IS_SOFTMAP% +torpidfiles=`echo %PROJECT_DIR%/%TOR_WORKER_PREFIX%*.d/tor.pid` +%%ELSE +torpidfiles=%PROJECT_DIR%/tor.pid +%%ENDIF + +ngxpidfile=%PROJECT_DIR%/nginx.pid + +# remove sockets + +sockets=`find %PROJECT_DIR% -name '*.sock'` + +# do it + +rm -f $torpidfiles $ngxpidfile $sockets + +# done + +exit 0