Script to auto-copy l4d assets
This commit is contained in:
parent
5f060f9ac0
commit
8035d21a27
1 changed files with 31 additions and 0 deletions
31
copy_l4d
Normal file
31
copy_l4d
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
|
watch_dir="/home/mod_exchange/"
|
||||||
|
dest_dir="/home/mpluser/l4d2/game/left4dead2/addons/"
|
||||||
|
|
||||||
|
function test_command {
|
||||||
|
"$@"
|
||||||
|
local status=$?
|
||||||
|
return $status
|
||||||
|
}
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
inotifywait --syslog -e close_write $watch_dir
|
||||||
|
for item in $watch_dir/*.zip
|
||||||
|
do
|
||||||
|
unzip -o ${item} -d ${watch_dir}
|
||||||
|
done
|
||||||
|
rm $watch_dir/*.zip
|
||||||
|
rsync $watch_dir/* /home/mpluser/l4d2/game/left4dead2/addons/ --remove-source-files
|
||||||
|
|
||||||
|
if test_command systemctl is-active l4d
|
||||||
|
then
|
||||||
|
sudo systemctl restart l4d
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
Loading…
Add table
Reference in a new issue