Eltex MES2324 backup script

I will give an example of my script for backing up the configuration of the Eltex MES2324B switch and similar models.

#!/bin/bash
mkdir /backups/ixnfo.com/eltex/`date +%Y-%m-%d`
cd /backups/ixnfo.com/eltex/`date +%Y-%m-%d`
 
(
sleep 4
echo "password"
sleep 2
echo "enable"
sleep 2
echo "password"
sleep 2
echo "copy running-config tftp://192.168.5.5/eltex.cfg"
sleep 8
echo "exit"
) | telnet 10.0.22.63
 
mv /srv/tftp/eltex.cfg /backups/ixnfo.com/eltex/`date +%Y-%m-%d`/eltex_iptv.cfg
 
find /backups/ixnfo.com/eltex/ -type d -mtime +30 -exec rm -rfv {} \;

The last command removes directories older than 30 days.

To make the script automatically run, for example at 01:15 at night, add the line below to the /etc /crontab file:

15 1 * * * root /backups/backup_cfg_eltex.sh > /dev/null 2>&1

See also my articles:
Configuring Eltex MES2324B
Install and configure tftpd-hpa

Leave a comment

Leave a Reply

Discover more from IT Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading