I will give an example of a script for backing up the GPON OLT BDCOM GP3600 configuration.
Actually, I sketched such a script:
#!/bin/bash
# REMOVE OLD FILES
find /srv/tftp/ -type f -mtime +200 -exec rm {} \;
# BDCOM test
(
sleep 5
echo "admin"
sleep 5
echo "password"
sleep 5
echo "enable"
sleep 2
echo "write all"
sleep 15
echo "copy startup-config tftp: 192.168.2.5"
sleep 3
echo "GP3600-08B_`date +%Y-%m-%d`_ixnfo.com.conf"
sleep 10
echo "exit"
sleep 3
echo "exit"
) | telnet 192.168.2.2
For automatic execution, add it to /etc/crontab:
0 1 * * * root /backups/scripts/backup_bdcom_gp3600.sh >/dev/null 2>&1
See also my articles:
Installing and Configuring a TFTP Server in Ubuntu
Using and configuring CRON
Backing up the BDCOM P3310 configuration