SYSTEM INFORMATION | |
---|---|
OS type and version | Ubuntu 22.04 |
Webmin version | 2.013 |
Virtualmin version | 7.5 |
When writing a script for “Command to run after making changes to a server”, how do I know whether the action being taken is “create”, “update” or “delete”?
I need to know this, as the script would be taking different steps depending on the action being taken by Virtualmin.
== MORE INFO ==
I’m developing a script which adds, updates, or removes entries from /etc/postfix/sender_relay
and /etc/postfix/sasl_passwd
in relation to a “sender_dependent” policy I’ve got setup.
Presently I manage this process somewhat “manually”, though it’d be nice to streamline the process along with domain creation.
My script works like: pm-relay-add --domain {domain}
where {domain}
represents a domain present on the server with mail
enabled. A secondary script called pm-relay-del
removes the domain from the two configurations, after which both scripts issue a rehash
of the two map files, and reload
of postfix.
*** I also developed a wrapper
script called virtualmin-import
which fetches all enabled
domains with mail
enabled, then passes each to pm-relay-add
accordingly ***