Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using Virtualmin, and I have a command set up under Virtualmin > Module Config > Actions Upon Server and user creation > Command to run after making changes to a server

This command is designed to perform a few additional steps after the account is set up. However, the action is called every time the account is modified, and also gets called when the account is deleted. The actions it performs should only be done when the account is first created.

How can my custom command know which action is being performed? Is there an environment variable which determines if the action is creation, alteration, or deletion?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Found the answer in the Virtualmin documentation: There's an environment variable $VIRTUALSERVER_ACTION available to the scripts which will contain one of:

  • CREATE_DOMAIN Set when a virtual server is being created.
  • DELETE_DOMAIN Set when a virtual server is being deleted.
  • MODIFY_DOMAIN Set when a virtual server is being changed, such as getting a new password, features or quota.
  • DISABLE_DOMAIN Set when a virtual server is being disabled via the UI or for exceeding its bandwidth limit.
  • ENABLE_DOMAIN Set when a virtual server is being enabled via the UI or for dropping back under its bandwidth limit.
  • RESTORE_DOMAIN Set when a virtual server is being restored from a backup.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.