added shell script and systemctl service for moving encaps edited files to stripper folder and for sending from stripper folder to his chroot jail

This commit is contained in:
jenz 2023-09-28 15:44:21 +02:00
parent bc5f212265
commit 923d46635e
2 changed files with 51 additions and 0 deletions

View File

@ -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

View File

@ -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