Suppose you need to add many subnets to the DHCP server configuration file, for example from 172.16.1.0 to 172.16.100.0, in this case this script will help.
Continue reading “DHCP configuration script”Category Archives: Scripts
Backup configuration of TP-Link switches
I wrote a script for backup configuration of TP-Link switches.
The script runs on Linux where the TFTP server is running, it is connected via telnet to the switch and the configuration command is sent to the specified TFTP, when the telnet connection is closed, the file is moved to the desired directory, and the last command deletes files longer than 30 days, as more of them I do not need to store.
You can also make a copy of all the files in the cloud every month.
As you can see, before entering a password in the script, you can not pause.
#!/bin/bash
{
echo "PASSWORD";
echo "enable";
echo "PASSWORD";
echo "copy startup-config tftp ip-address 192.168.0.5 filename tplink";
sleep 2;
echo "exit";
sleep 1;
echo "exit";
} | telnet 192.168.0.110
mv /srv/tftp/tplink.cfg /backups/devices/tplink/`date +%Y-%m-%d`_tplink.cfg
find /backups/devices/tplink/ -type f -mtime +30 -exec rm {} \;
Script to delete old files
I recently did something like a private file sharing, and to not control what users are uploading, added a script in cron that files that were deleted automatically for more than 3 days.
Continue reading “Script to delete old files”