Directadmin give the developer the ability to write custom scripts using post and pre hook which can be used in /usr/local/directadmin/scripts/custom


If you want to get what kind of variable each script can pass then you need to write a simple one line bash script. For example, let us say that you need to get the information about the variable for the custom script called:

Inside the, you could write the following simple bash:

#!/bin/bash env | grep -v pass > $0.env

What the code does is, when Directadmin executed, it will generate a file call This file will contains all the information about the variable that was passed through Here is the example of the content:


minute=0 database_data_aware=yes owner=usertest _=/usr/bin/env LANG=en_US.UTF-8 where=local when=now id=1 value=multiple USER=root who=all local_path=/backup/admin_backups/admin_backups-31-07-2020_23-44-01 hour=5 PWD=/usr/local/directadmin HOME=/root success=1 dayofmonth=* type=admin reseller=admin append_to_path=custom:admin_backups-%d-%m-%Y_%H-%M-%S file=/backup/admin_backups/admin_backups-31-07-2020_23-44-01/admin.admin.user.tar.gz trash_aware=yes xml_file=/backup/admin_backups/admin_backups-31-07-2020_23-44-01/user/backup/ username=maxisofi88 email_data_aware=yes action=backup SHELL=/bin/sh dayofweek=* month=* SHLVL=3 LANGUAGE=en current_result=
User abc has been backed up. <23:44:01>

The Admin backups have been created in /backup/admin_backups/admin_backups-31-07-2020_23-44-01 <23:44:51>
LOGNAME=root PATH=/usr/bin:/bin


You will see some variables are passed through the script in the above example. For example the variable of success=1 which indicates that the backup is success. You can then use the variable $success in your script to write more condition.


Best regards,

Arafat Ali