Hi, i would love if someone can help me with this script. it used for backup clish configuration of all GWs remotely from mgmt, save i to file and upload to ftp server. i guess it's something simple to those familiar with bash more than i do.
it was working fine, by creating seperate file for each gw which GWName_Date.txt filename. but lately (maybe from some ver upgrade) it failed to save the filename with $hostname, so it's only save it with the date like 11.7.21.txt, and this cause that each time it override this file, because all files get the same name. if i just run from mgmt cprid_util -server x.x.x.x -verbose rexec -rcmd /bin/bash -c "hostname" it brings the correct hosname. what can be the problem here? how can i fix it?
thx!
#!/bin/sh
source /opt/CPshrd-R80.40/tmp/.CPprofile.sh
for dest in $(</var/log/scripts/gws_list.txt); do
hostname=`cprid_util -server $dest -verbose rexec -rcmd /bin/bash -c "hostname"`
now=$(date +"%m_%d_%Y").txt
cprid_util -server $dest -verbose rexec -rcmd /bin/clish -c "show configuration" > /var/log/gws_backup/$hostname_$now
done
.........ftp commands.....
rm /var/log/gws_backup/*