Scripts and event hooks
Run your own programs when accounts change, and use the panel's command-line tools.
Event scripts (hooks)#
A hook is a program of your own that the panel runs when something happens to an account, for example to tell a billing system or to write a log. The events are:
| Event | When it runs |
|---|---|
account-created | After a hosting account is created |
account-deleted | After a hosting account is deleted |
account-suspended | After a hosting account is suspended |
account-unsuspended | After a suspended account is restored |
Add a hook#
- Put a program named exactly after the event into
/etc/intopanel/hooks, for example/etc/intopanel/hooks/account-created. - Make it owned by root and readable and runnable by root only:
chown root:root /etc/intopanel/hooks/account-created
chmod 700 /etc/intopanel/hooks/account-created- Open Developer Tools → Event Scripts (Hooks) in the admin area. The event shows Installed. If the file is there but not safe to run, it shows Not run with the reason.
The program gets the account's username as its first argument and, when an account is created, the main domain as the second. The same values are in the environment as INTOPANEL_USER, INTOPANEL_DOMAIN and INTOPANEL_EVENT.
#!/bin/bash
# /etc/intopanel/hooks/account-created
echo "$(date -u +%FT%TZ) $INTOPANEL_EVENT $INTOPANEL_USER $INTOPANEL_DOMAIN" >> /root/account-events.logCommand-line tools#
Reset a lost administrator password, create another administrator, or switch off two-step sign-in for a login that lost its phone:
runuser -u intopanel -- /usr/local/intopanel/bin/intopanel-web -reset-password admin
runuser -u intopanel -- /usr/local/intopanel/bin/intopanel-web -create-admin NAME
runuser -u intopanel -- /usr/local/intopanel/bin/intopanel-web -disable-two-step NAMECheck the two parts of the panel:
systemctl status intopanel-web intopaneld
journalctl -u intopaneld -n 100 --no-pagerintopanel-web serves the pages; intopaneld runs as root and makes the changes. If the dashboard says "The panel daemon did not answer", start with systemctl status intopaneld.