Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

closed as off-topic by Falcon Momot, MadHatter, mdpc, womble Oct 8 '15 at 23:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

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

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