This script restores an IPControl database from a provided SQL dump (packaged as a .zip file).
It unpacks the SQL, stops the InControl service, starts MySQL, and loads the SQL dump into the database.
./ipctrl_restore-reset.sh <path_to_sql.zip_file>Example:
./ipctrl_restore-reset.sh /tmp/ipcontrol-backup-20250101.sql.zip- Validates that a
.zipfile argument is provided. - Unpacks the archive to extract the
.sqlfile. - Moves the
.sqlfile into the MySQL bin directory:/opt/incontrol/mysql/bin - Stops the InControl service:
/opt/incontrol/etc/incontrol stop - Starts the MySQL server:
/opt/incontrol/etc/mysqld_start - Waits for MySQL startup before continuing.
- Prepares to restore the SQL dump into the InControl database.
- Logs all actions into a timestamped logfile created in the script directory.
- Log file:
ipctrl_restore-reset_<timestamp>.log - Console messages showing unpacking, service stop/start, and SQL file movement.
- Bash
- BlueCat IPControl environment with:
/opt/incontrol/etc/incontrol(service scripts)/opt/incontrol/etc/mysqld_start/opt/incontrol/mysql/bin/mysql
- Tools:
unzip,mv,sleep
- Default database user/password are set in the script (
incadmin/incadmin). Update as needed. - The SQL dump filename is derived from the
.ziparchive name. - Run during maintenance windows — this process stops InControl services.
- Ensure the
.zipcontains a valid.sqlfile.
This script is covered under the repository’s main MIT License.