GoAdmio

delete

Delete a GoAdmio account and everything it owns, taking a recovery snapshot first unless --force is used

On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also


Overview

/go/delete removes a hosting account from the server in one command. It deletes:

Before deleting anything it takes a snapshot, so the account can be restored with recover. --force skips that step.

[!WARNING] Deletion cannot be undone, and databases are dropped permanently. Without a snapshot, nothing can be recovered, so use --force only when you are sure. Always pass the domain. The script does not check for an empty one. See Known issue: empty domain.


Quick start

# Delete an account (a snapshot is taken first)
/go/delete example.com

Syntax

/go/delete <domain> [--force]

Run the command as root. It has no confirmation prompt.


Arguments

Argument Required Notes
<domain> Yes The account's domain, exactly as stored. Unlike create, delete does not lowercase it or remove a leading www..
--force No Skips the snapshot, and the recovery hint at the end. The account cannot be recovered. It is recognized anywhere in the arguments.

Output

Preparing to delete example.com...
Deleting files...
Dropping MySQL/MariaDB database example_db...
Dropping PostgreSQL database example_pg...
Domain example.com has been deleted.

The example is illustrative. The Dropping lines appear only for databases the account owns.

Message Meaning
Preparing to delete <domain>... The snapshot is being taken. Not shown with --force.
Deleting files... Deletion has started.
Dropping MySQL/MariaDB database <name>... A MySQL/MariaDB database is being dropped.
Dropping PostgreSQL database <name>... A PostgreSQL database is being dropped.
Domain <domain> has been deleted. The run finished.
Domain <domain> not exists The domain is not in the GoAdmio database and has no /home/<domain>/www folder. Exit status 1.
Unknown operating system. The OS is not supported. See Troubleshooting.

After a deletion without --force, if you ran the command in a terminal and /var/go/etc/snapshot.conf exists, a boxed note shows how to recover the account:

Info: Domain Deletion Recovery
If you deleted a domain example.com by mistake, you can recover it with:
/go/recover example.com

Examples

# Normal deletion, recoverable
/go/delete example.com
# Delete without a snapshot (not recoverable)
/go/delete example.com --force
# Restore a deleted account from its snapshot
/go/recover example.com
# Reload the web server and PHP-FPM afterward
/go/reload

Troubleshooting

Symptom Likely cause Fix
Domain <domain> not exists The domain is misspelled, has different capitalization, or has a www. prefix that isn't part of the stored name. Use the domain exactly as it appears in the control panel.
The command takes a long time before it deletes anything A snapshot of the whole account is taken first. Wait, or use --force if you don't need a snapshot.
I deleted an account by mistake — Run /go/recover <domain>. This works only if a snapshot was taken, so not after --force.
Unknown operating system. The OS is not AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, or Ubuntu. The account is already hidden in the control panel (Trash=1) but its files remain. To show it again, run sqlite3 /var/lib/sqlite/site.db "UPDATE Site SET Trash=0 WHERE Domain='<domain>'".
The account vanished from the panel but its files are still there The run stopped after the account was marked as trashed, for example it was interrupted. Run /go/delete <domain> again.
The site is still served after deletion The web server and PHP-FPM are not reloaded by this command. Run reload.
Mail for the domain is still accepted The mail-domain entry was removed from the file, but the Postfix/Dovecot maps may not have been rebuilt. Run vmail.
A database could not be dropped The database no longer exists, or its name has characters that need quoting. Drop it by hand with mariadb or dropdb.
An old SSL certificate, database user, or /s3/<domain> folder is left behind No step in the script removes them. Remove them by hand if you no longer need them.

Details

What it does

flowchart TD
    A["delete domain [--force]"] --> B{"In the database or has a www folder?"}
    B -- "No" --> X["Print Domain not exists, exit 1"]
    B -- "Yes" --> C["Mark the account as trashed in the panel"]
    C --> D{"--force given?"}
    D -- "No" --> E["Take a snapshot with the snapshot command"]
    D -- "Yes" --> F
    E --> F{"Supported operating system?"}
    F -- "No" --> Y["Print Unknown operating system, stop"]
    F -- "Yes" --> G["Delete PHP-FPM pool, user, home folder, and virtual hosts"]
    G --> H["Drop MySQL/MariaDB and PostgreSQL databases"]
    H --> I["Delete DNS zone, FTP permissions, mail-domain entry, DKIM keys, and cron job"]
    I --> J["Delete the account's rows from the GoAdmio databases"]
    J --> K["Print confirmation and the recovery hint"]
    K --> L["Remove the recover log so recover can run immediately"]

Steps, in order

  1. Appends the call to /var/log/go/delete.log.
  2. Looks up the account's username and checks that the domain exists. It stops only if the domain is neither in the database nor has a www folder.
  3. Marks the account as trashed (Trash=1) so it disappears from the control panel at once.
  4. Unless --force is used, takes a snapshot with snapshot. Its output is hidden, and the deletion goes ahead even if the snapshot fails.
  5. Deletes the PHP-FPM pool configuration. On the Red Hat family this covers /etc/php-fpm.d and the per-version Remi folders. On Debian and Ubuntu it covers every /etc/php/*/fpm/pool.d.
  6. Removes the system user, then /home/<domain>.
  7. Removes the Apache virtual host and its -le-ssl version, and the Nginx virtual host and its .bak file.
  8. Drops each MySQL/MariaDB database registered to the domain, then each PostgreSQL database.
  9. Deletes the DNS zone with zone.
  10. Removes /etc/vsftpd/permission/<domain>, the domain's line in /etc/postfix/vmail_domains, /etc/opendkim/<domain>, and the cron file /etc/cron.d/<domain with dots replaced by underscores>.
  11. Deletes the domain's rows from the Site, Alias, Subdomain, Directory, Mysql, Postgre, SQLite, Mail, and Ftp tables.
  12. Prints the confirmation, and the recovery hint when it applies.
  13. Removes /var/log/go/recover/<domain>.log, so that recover can be used right away.

Known issue: empty domain

The existence check compares the stored domain with the argument. If the argument is empty, both are empty and the check passes. The later steps then build paths such as /home/, /etc/opendkim/, and /etc/vsftpd/permission/ with nothing after the slash, so they would delete those whole folders. This can happen from a script whose domain variable is empty.

Until the script checks for an empty or invalid domain, always pass a domain, and quote variables in scripts that call this command.

What it does not remove

No step in the script removes these:

What it does not reload

The command does not restart or reload Apache, Nginx, PHP-FPM, Postfix, or Dovecot. Run reload and, if needed, vmail afterward.

Side effects


See also

Command Description
recover Restore a deleted account from its latest snapshot
snapshot Restic-based per-domain snapshot backup and restore
create Create a GoAdmio account from the command line
suspend Suspend a GoAdmio account via the command line
backup Create a backup for all GoAdmio accounts (local and remote)
restore Restore a GoAdmio backup from the command line
zone Create, update, or delete a DNS zone file and register it with BIND
reload Reload PHP-FPM and the active web server