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