fix: harden backend synchronization
This commit is contained in:
@@ -3,6 +3,7 @@ set -eu
|
||||
|
||||
BASE_DIR="/usr/local/hitme_plugins/global-autoresponders"
|
||||
PLUGIN_DIR="/usr/local/directadmin/plugins/global-autoresponder"
|
||||
CRON_FILE="/etc/cron.d/global-autoresponder"
|
||||
|
||||
mkdir -p "$BASE_DIR/config/users" "$BASE_DIR/data/users" "$BASE_DIR/state/replies" "$BASE_DIR/logs"
|
||||
chmod 700 "$BASE_DIR/config" "$BASE_DIR/logs"
|
||||
@@ -20,4 +21,7 @@ fi
|
||||
|
||||
touch "$BASE_DIR/logs/audit.log"
|
||||
chmod 600 "$BASE_DIR/logs/audit.log"
|
||||
|
||||
printf '%s\n' "*/15 * * * * root $PLUGIN_DIR/scripts/sync_directadmin_vacations.php >/dev/null 2>&1" > "$CRON_FILE"
|
||||
chmod 644 "$CRON_FILE"
|
||||
echo "global-autoresponder installed"
|
||||
|
||||
@@ -11,6 +11,7 @@ mkdir -p "$ROOT_DIR/archives/$VERSION"
|
||||
tar -czf "$ROOT_DIR/archives/$VERSION/global-autoresponder.tar.gz" \
|
||||
--exclude='./.git' \
|
||||
--exclude='./tests' \
|
||||
--exclude='./scripts/package.sh' \
|
||||
--exclude='./data' \
|
||||
--exclude='./state' \
|
||||
--exclude='./logs' \
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
set -eu
|
||||
|
||||
BASE_DIR="/usr/local/hitme_plugins/global-autoresponders"
|
||||
PLUGIN_DIR="/usr/local/directadmin/plugins/global-autoresponder"
|
||||
CRON_FILE="/etc/cron.d/global-autoresponder"
|
||||
|
||||
if [ -x "$PLUGIN_DIR/scripts/backend.sh" ]; then
|
||||
"$PLUGIN_DIR/scripts/backend.sh" da || true
|
||||
fi
|
||||
rm -f "$CRON_FILE"
|
||||
|
||||
if [ "${PURGE_GLOBAL_AUTORESPONDER_DATA:-0}" = "1" ]; then
|
||||
rm -rf "$BASE_DIR"
|
||||
echo "global-autoresponder data purged"
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
set -eu
|
||||
|
||||
BASE_DIR="/usr/local/hitme_plugins/global-autoresponders"
|
||||
PLUGIN_DIR="/usr/local/directadmin/plugins/global-autoresponder"
|
||||
CRON_FILE="/etc/cron.d/global-autoresponder"
|
||||
mkdir -p "$BASE_DIR/config/users" "$BASE_DIR/data/users" "$BASE_DIR/state/replies" "$BASE_DIR/logs"
|
||||
printf '%s\n' "*/15 * * * * root $PLUGIN_DIR/scripts/sync_directadmin_vacations.php >/dev/null 2>&1" > "$CRON_FILE"
|
||||
chmod 644 "$CRON_FILE"
|
||||
echo "global-autoresponder updated; external configuration preserved"
|
||||
|
||||
Reference in New Issue
Block a user