/go/clean: clean from the Command Line

/go/clean removes files that are no longer needed so they stop using disk space. In one run it: It needs root. If you run it as another user, it re-runs itself with sudo. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Clean up files older than 14 days
/go/clean

[!WARNING]
Everything this command deletes is deleted permanently. There is no confirmation, no dry run, and no recycle bin. Trash folders are emptied regardless of age, and --force removes backup archives regardless of age. Make sure the backups you need are stored somewhere other than the account home folders.

Options

Option Required Default Notes
--force No — Skips the 14-day age check for backup archives and backup folders in /home/<domain>/. Nothing else changes.

Other arguments are ignored. The option is detected by searching the whole argument list for the text --force, so any argument containing it, such as --forceful, also triggers force mode.

Examples

# Routine cleanup
/go/clean

# Free as much space as possible: delete every backup archive in the account folders
/go/clean --force

# Check what was run and when
tail -n 20 /var/log/go/clean.log

# Clean up every night at 03:00
0 3 * * * /go/clean

# Keep only 30 days of mail for a new account
/go/create --domain example.com --mailttl 30

Output

The command prints nothing of its own. Any output comes from the commands it calls, such as reload.

Every run is logged with a timestamp, for example [Nov 20 03:00:01]# clean --force, to /var/log/go/clean.log.

The command sets no exit code of its own. It exits with the status of the last command it ran, so don’t rely on it in scripts.

See the full reference at /go/clean and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *