29 lines
822 B
Bash
Executable File
29 lines
822 B
Bash
Executable File
#!/usr/bin/bash
|
|
|
|
openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert fda7d7ed64a9bd84562c6643e858c4a61cfdc6e90b0d4ee60e07fd0bb7fb7a9f --password=$PASSWORD &
|
|
while [ ! `ip a | grep -q "inet .*ppp" && echo "1"` ];
|
|
do
|
|
#echo checking
|
|
sleep 1
|
|
done
|
|
sleep 3
|
|
dirname=$(uv run backupfortigate.py 192.168.1.241 $FG_USERNAME $FG_PASSWORD)
|
|
|
|
uv run splitfgconfig.py $dirname/fg-short.conf
|
|
|
|
subdirs=$(find $dirname -type d -name "v*" -or -name "gl*")
|
|
|
|
changes=no
|
|
for subdir in $subdirs; do
|
|
diff -q $subdir /configs/fortigate/$(basename $subdir) || changes=yes
|
|
diff -q $subdir /configs/fortigate/$(basename $subdir) || cp -f -r $subdir /configs/fortigate/
|
|
done
|
|
|
|
echo changes=$changes
|
|
|
|
if [ $changes = "yes" ];then
|
|
cp $dirname/fg-full.conf /configs/fortigate/fortigate.conf
|
|
fi
|
|
|
|
chown -R 1000:1000 /configs/
|