From 923d46635eaaaf4eee4b7efad472064e80d240b8 Mon Sep 17 00:00:00 2001 From: jenz Date: Thu, 28 Sep 2023 15:44:21 +0200 Subject: [PATCH] added shell script and systemctl service for moving encaps edited files to stripper folder and for sending from stripper folder to his chroot jail --- file_mover/encap_stripper_mover.sh | 41 +++++++++++++++++++ .../systemctl/encap_stripper_mover.service | 10 +++++ 2 files changed, 51 insertions(+) create mode 100644 file_mover/encap_stripper_mover.sh create mode 100644 file_mover/systemctl/encap_stripper_mover.service diff --git a/file_mover/encap_stripper_mover.sh b/file_mover/encap_stripper_mover.sh new file mode 100644 index 00000000..26575397 --- /dev/null +++ b/file_mover/encap_stripper_mover.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +upload_dir="/home/test/home/stripper_files/upload" +stripper_dir="/home/gameservers/css_ze/cstrike/addons/stripper/maps" +maps_dir="/home/test/home/stripper_files/maps" + +# Check if the source directory exists +if [ -d "$upload_dir" ]; then + for file in "$upload_dir"/*; do + if [ -f "$file" ]; then + # Move each file to the destination directory + chown gameservers:gameservers "$file" + chmod 775 "$file" + mv "$file" "$stripper_dir/" + echo "File '$file' moved successfully." + fi + done +fi + + +if [ -d "$stripper_dir" ]; then + for file in "$stripper_dir"/*; do + if [ -f "$file" ]; then + #copy each file to maps_dir + cp --force "$file" "$maps_dir/" + echo "File '$file' moved successfully." + fi + done +fi + +if [ -d "$maps_dir" ]; then + for file in "$maps_dir"/*; do + if [ -f "$file" ]; then + #copy each file to maps_dir + chown stripper_files:stripper_files "$file" + chmod 775 "$file" + echo "File '$file' modified successfully." + fi + done +fi + diff --git a/file_mover/systemctl/encap_stripper_mover.service b/file_mover/systemctl/encap_stripper_mover.service new file mode 100644 index 00000000..54fa8b20 --- /dev/null +++ b/file_mover/systemctl/encap_stripper_mover.service @@ -0,0 +1,10 @@ +[Unit] +Description=Moves stripper files from /home/test/home/stripper_files/upload to the css ze servers stripper/maps dir + +[Service] +Type=simple +User=root +WorkingDirectory=/home/test/home/stripper_files +ExecStart=/home/test/home/stripper_files/encap_stripper_mover.sh +Restart=always +RestartSec=20s