DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for a simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize and support it.

Directadmin hooks: custom PRE and POST action scripts

| 11:11:11 01.05.2019

DirectAdmin allows to run custom scripts before and after a certain action performed by the control panel. So called hooks, or hookable events are custom PRE and POST action scripts. If a script doesn't exist, it won't be run. If it exists, it will be executed by DA with superuser permissions.

The hook-scripts allow server administrators to add customized scripts for various tasks such as creating/removing Users and Domains. It'is possible to use any scripting language within hooks as well as to call compiled binaries. 

DirectAdmin passes environmental variables to the scripts, which can be used for any purposes. Though they won't be passed back even if you change them.

Location

All hooks, i.e. custom scripts should be placed under /usr/local/directadmin/scripts/custom/. The folder is empty by default, so you will need to create desired scripts first, then set correct permissions, and populate them with a needed content.

  • Directory: /usr/local/directadmin/scripts/custom/
  • Permissions: 700
  • Ownership: diradmin:diradmin


PRE scripts

These hooks to be executed before an action in Directadmin. The control panel will check what a script returns, a non-zero exit code will terminate the main action. An error will be reported.

  • all_backups_pre.sh
  • all_pre.sh
  • autoresponder_delete_pre.sh
  • autoresponder_set_pre.sh
  • backup_save_pre.sh
  • brute_force_notify_pre.sh
  • cron_set_pre.sh
  • database_create_pre.sh
  • database_delete_pre.sh
  • database_user_password_change_pre.sh
  • domain_change_pre.sh
  • domain_create_pre.sh
  • domain_destroy_pre.sh
  • domain_modify_pre.sh
  • domain_pointer_create_pre.sh
  • domain_pointer_destroy_pre.sh
  • email_change_pass_pre.sh
  • email_create_pre.sh
  • email_destroy_pre.sh
  • email_filter_write_pre.sh
  • filemanager_pre.sh
  • forwarder_create_pre.sh
  • forwarder_delete_pre.sh
  • ip_change_pre.sh
  • letsencrypt_pre.sh
  • load_spike_notice_pre.sh
  • lost_password_pre.sh
  • overusage_notice_pre.sh
  • public_html_link_set_pre.sh
  • reseller_destroy_pre.sh
  • reseller_modify_pre.sh
  • sendmail_pre.sh
  • session_destroy_pre.sh
  • ssl_save_pre.sh
  • subdomain_create_pre.sh
  • subdomain_destroy_pre.sh
  • tally_pre.sh
  • user_activate_pre.sh
  • user_backup_compress_pre.sh
  • user_backup_pre.sh
  • user_create_pre.sh
  • user_destroy_pre.sh
  • user_httpd_write_pre.sh
  • user_modify_pre.sh
  • user_password_change_pre.sh
  • user_restore_pre.sh
  • user_suspend_pre.sh
  • vacation_set_pre.sh


POST scripts

These are hooks to be executed by DirectAdmin after a certain action is completed. The control panel might check the exit-code as well and roll-back performed action on a non-zero exit-code. So be careful.

  • all_backups_post.sh
  • all_post.sh
  • all_restores_post.sh
  • autoresponder_set_post.sh
  • check_partitions_notice_post.sh
  • cron_set_post.sh
  • database_create_post.sh
  • database_delete_post.sh
  • database_user_create_post.sh
  • database_user_destroy_post.sh
  • database_user_password_change_post.sh
  • dkim_create_post.sh
  • dns_create_post.sh
  • dns_delete_post.sh
  • dns_raw_save_post.sh
  • dnssec_sign_post.sh
  • dns_write_post.sh
  • domain_change_post.sh
  • domain_create_post.sh
  • domain_destroy_post.sh
  • domain_modify_post.sh
  • domain_pointer_create_post.sh
  • domain_pointer_destroy_post.sh
  • email_change_pass_post.sh
  • email_create_post.sh
  • email_destroy_post.sh
  • email_filter_write_post.sh
  • file_manager_upload_post.sh
  • forwarder_create_post.sh
  • forwarder_delete_post.sh
  • ftp_delete_post.sh
  • ip_change_post.sh
  • ipsconf_write_post.sh
  • letsencrypt_post.sh
  • load_spike_notice_post.sh
  • named_action_post.sh
  • openlitespeed_ips_conf_write_post.sh
  • openlitespeed_listeners_write_post.sh
  • overusage_notice_post.sh
  • public_html_link_set_post.sh
  • reseller_modify_post.sh
  • spam_script_chmod_0_post.sh
  • ssl_save_post.sh
  • subdomain_create_post.sh
  • subdomain_destroy_post.sh
  • tally_post.sh
  • tally_rotation_post.sh
  • tally_user_post.sh
  • taskq_dns_post.sh
  • update_post.sh
  • user_activate_post.sh
  • user_backup_post.sh
  • user_create_post.sh
  • user_destroy_post.sh
  • user_httpd_write_post.sh
  • user_info_modify_post.sh
  • user_modify_post.sh
  • user_password_change_post.sh
  • user_restore_fail_post.sh
  • user_restore_post.sh
  • user_suspend_post.sh
  • vacation_set_post.sh


The list is actualized as of the DirectAdmin Version: v.1.56.4.

About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable experience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.




All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition