This commit is contained in:
Valeria Fadeeva 2023-12-12 11:52:13 +05:00
parent cc298567cd
commit fe8f94c4bb
1 changed files with 22 additions and 1 deletions

23
push.sh
View File

@ -1,7 +1,28 @@
#!/bin/bash
ip1="10.120.152.1"
ip2="192.168.1.250"
ip r | grep 10.120.152.1
if [[ $? == 0 ]]; then
ping -c 1 10.120.152.1
if [[ $? == 0 ]]; then
ip=$ip1
fi
else
ping -c 1 192.168.1.250
if [[ $? == 0 ]]; then
ip=$ip2
fi
fi
git add . && git commit -m "Update" && git push
ssh home -f '~/update-site.sh'
ssh ${ip} -f '~/update-site.sh'
status=$?
echo "Ready"
if [ "$status" == 0 ]; then
sleep 5
kill $(ps x | grep konsole | grep $0 | awk '{print $1}')
fi