Is there a way to run a script after restoring a virtual server?
Status:
Active
Comments
Submitted by andreychek on Sat, 09/10/2011 - 22:46Comment #1
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:
Submitted by JamieCameron on Sat, 09/10/2011 - 23:54Comment #2
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/post-change.sh .
Then create the /etc/post-change.sh script containing code like :
#!/bin/sh if [ "$VIRTUALSERVER_ACTION" = "RESTORE_DOMAIN" ]; then # your script here fi
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.
Comments
Submitted by andreychek on Sat, 09/10/2011 - 22:46 Comment #1
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
/path/to/other/script/here
Submitted by JamieCameron on Sat, 09/10/2011 - 23:54 Comment #2
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/post-change.sh
.Then create the
/etc/post-change.sh
script containing code like :#!/bin/sh
if [ "$VIRTUALSERVER_ACTION" = "RESTORE_DOMAIN" ]; then
# your script here
fi
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.
Submitted by timmy on Sun, 09/11/2011 - 23:03 Comment #3
cool stuff.