script to run after restoring a virtual server

Is there a way to run a script after restoring a virtual server?



No, there's no feature that allows you to automatically run a script when restoring a Virtual Server.

The only way to accomplish that is if you were restoring the Virtual Server from the command line, using the command line tools. With that, you could could call a script.

For example, you could create a script that includes these two lines:

virtualmin restore-domain --source /path/to/backup_file.tar.gz

Actually, the pre and post domain modification scripts get run for a restore as well.

You can go to System Settings -> Virtualmin Configuration -> Actions upon server and user creation and set the "Command to run after making changes to a server" to something like /etc/ .

Then create the /etc/ script containing code like :

  # your script here

You can use the variable $VIRTUALSERVER_DOM to get the name of the domain that was restored, and other variables starting with VIRTUALSERVER_ for other details.