GoAdmio

cron

Rebuild GoAdmio's cron jobs, server-wide or for one domain, and restart or stop the cron service

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


Overview

/go/cron writes the cron files that run GoAdmio's scheduled work. It manages two kinds of file in /etc/cron.d/:

It can also restart or stop the cron service, and open the main file in an editor.


Quick start

# Rebuild the main cron file and restart cron
/go/cron

# Rebuild the cron jobs of one domain
/go/cron example.com

[!WARNING] /etc/cron.d/go and the per-domain files are rewritten completely each time. Manual edits are lost. /go/cron stop stops the cron service, so no scheduled job on the server runs until you start it again with /go/cron restart.


Syntax

# Rebuild the main cron file
/go/cron

# Rebuild one domain's cron file
/go/cron <domain>

# Restart or stop the cron service
/go/cron restart
/go/cron stop

# Edit the main cron file
/go/cron -e
Form Behavior
/go/cron Rebuilds /etc/cron.d/go and restarts the cron service.
/go/cron <domain> Rebuilds /etc/cron.d/<domain> from the domain's active cron jobs and restarts the cron service.
/go/cron restart Restarts the cron service.
/go/cron stop Stops the cron service.
/go/cron -e Opens /etc/cron.d/go in nano.

Arguments

Argument Notes
<domain> Any argument that contains a dot is treated as a domain. /home/<domain>/www must exist.
restart, stop Run systemctl restart or systemctl stop on crond (AlmaLinux, Rocky, CentOS, Red Hat, Fedora) or cron (Debian, Ubuntu).
-e Edits the main file. Run it as root.

Any other argument, or none, rebuilds the main file.


Output

The command prints nothing, except Domain <domain> does not exist. when the domain's www folder isn't found.

Every run is logged with a timestamp, for example [Nov 20 09:15:02]# cron example.com, to /var/log/go/cron.log. The output of the scheduled jobs themselves goes to files in /var/log/go/cron/, such as hourly.log and backup.log.

Domain, restart, stop, and -e runs, and the MinIO case described in Details, always exit with status 1, even when they work. Don't use the exit status to check for success.


Examples

# Rebuild the main cron file
/go/cron
# Apply changes to the cron jobs of example.com
/go/cron example.com
# Stop and start the cron service
/go/cron stop
/go/cron restart
# View the main cron file and the per-domain files
cat /etc/cron.d/go
ls /etc/cron.d
# Check the output of a scheduled job
tail /var/log/go/cron/hourly.log
# Check for cron errors
journalctl -u crond -n 20        # AlmaLinux, Rocky, CentOS, Red Hat, Fedora
journalctl -u cron -n 20         # Debian, Ubuntu

Troubleshooting

Symptom Likely cause Fix
Domain <domain> does not exist. /home/<domain>/www doesn't exist. Check the domain name.
A domain's job isn't in its cron file The job is inactive, has no username, or its schedule is invalid. Invalid schedules are skipped without a message. Check the job and run /go/cron <domain> again. A schedule needs five fields made of digits, *, /, ,, and -.
A domain's job fails with No such file or directory The command is always prefixed with /usr/bin/. A command such as /usr/local/bin/tool becomes /usr/bin//usr/local/bin/tool. Enter commands that are in /usr/bin, such as php /home/example.com/www/cron.php.
My changes to /etc/cron.d/go disappeared The file is rebuilt on every run. Don't edit it by hand. Make changes in the configuration files described in Details.
No cron emails arrive When any SMTP relay is configured, MAILTO is set to empty to avoid using relay email credits. Expected. Read the logs in /var/log/go/cron/ instead.
Nothing is scheduled, or jobs stopped The cron service was stopped. Run /go/cron restart.
The brevo check job never runs The line for it is missing the day, month, and weekday fields (see Details), so cron can't read it. Check /etc/cron.d/go and the cron log.
A backup, snapshot, or MariaDB job is missing The Cron= value in its configuration file isn't a valid five-field schedule. Correct the value. Backup, snapshot, secondary, and tertiary jobs are only added when it is valid.
Lines in /etc/cron.d/go are broken, with jobs split over several lines The server has several network interfaces, so the MAC-based time values contain more than one number. Look at /etc/cron.d/go and report it, because the times are calculated from the ifconfig output.
Only two jobs are in /etc/cron.d/go This is a MinIO server with SSL configured. Expected. See Details.
/go/wa appears twice Both the crmrealty.net special case and /var/go/etc/wa apply. See Details.

Details

Main cron file

The main file starts with these lines, then the jobs below:

The jobs use a minute value M and an hour value T that are meant to be fixed for the server and calculated from its MAC address, so that different servers don't all run their heavy jobs at the same moment.

Schedule Job Condition
At boot storage /root/.config/rclone/rclone.conf exists, and either /var/go/etc/storage exists or the rclone configuration has a [storage] section.
Every hour hourly Always. Output in /var/log/go/cron/hourly.log.
Every 20 minutes 20min Always. Output in /var/log/go/cron/20min.log.
08:00 to 22:00, every 2 hours brevo check An active Brevo SMTP relay on port 587 is configured.
Daily at 23:55, 23:56, 23:57 bandwidth, outgoing, incoming Always.
Every second day of the month at T:M update Always.
Daily at 04:M maria refresh /var/go/etc/maria.conf exists.
The schedule in Cron= of maria.conf, or 12:M, 16:M, and 20:M if it is missing or invalid maria /var/go/etc/maria.conf exists.
The schedule in Cron= of backup.conf backup /var/go/etc/backup.conf exists with a valid schedule.
The schedule in Cron= of secondary.conf backup secondary /var/go/etc/secondary.conf exists with a valid schedule.
The schedule in Cron= of tertiary.conf backup tertiary /var/go/etc/tertiary.conf exists with a valid schedule.
The schedule in Cron= of snapshot.conf snapshot /var/go/etc/snapshot.conf exists with a valid schedule.
At minutes 15, 30, and 45 of every hour iptop underattack Always.
At minutes 5 and 35 of every hour usertop Always.
At minutes 20 and 50 of every hour mysqltop Always.
Every 10 minutes uptime /var/go/etc/uptime exists.
Every minute wa /var/go/etc/wa exists.
Every 3 minutes whatsapp /usr/local/goadmio/whatsapp exists.
Every 5 minutes, plus wa every minute Two curl requests to crmrealty.net /home/crmrealty.net/www exists. This block is hard-coded for one domain.

The commands hourly, 20min, wa, and whatsapp aren't in the command index. Output of jobs that redirect it goes to /var/log/go/cron/<name>.log.

A Cron= value must be a five-field schedule such as 30 2 * * *. Quotes and semicolons around it are ignored.

The brevo check line is written as 0 8,10,12,14,16,18,20,22 root /go/brevo check. It has only two schedule fields before root, but cron needs five. Depending on the cron version, cron may skip that line or reject the whole file when this job is enabled.

MinIO servers

If /usr/local/goadmio/minio/minio.conf exists and contains :443 , the main file contains only MAILTO, MAILFROM, miniossl on the 1st and 15th of each month at midnight, and checkssl daily at 18:00. The command then exits without restarting cron.

Domain cron files

For <domain>, the command:

  1. Checks that /home/<domain>/www exists.
  2. Writes /etc/cron.d/<domain with dots replaced by underscores>, for example example_com.
  3. Starts the file with MAILTO set to the domain's email address, or to empty if any SMTP relay is configured.
  4. Adds one line for each active job of the domain in GoAdmio's cron database that has a username. Empty schedule fields become *.
  5. Restarts the cron service.

Each line has the form <schedule> <username> /usr/bin/<command>. A job with an invalid schedule is skipped. If the domain has no valid jobs, the file contains only the MAILTO line, which removes its old jobs.

Restarting and stopping

restart and stop call systemctl on crond for AlmaLinux, Rocky, CentOS, Red Hat, and Fedora, and on cron for Debian and Ubuntu. On any other system they do nothing.


See also

Command Description
cronjob Run your own daily, weekly, and monthly shell scripts from /var/go/cron/
backup Create a backup for all GoAdmio accounts (local and remote)
snapshot Restic-based per-domain snapshot backup and restore
maria Incremental MariaDB backup to S3 or via Rclone
update Update GoAdmio to the latest version via the command line
brevo Manage Brevo (Sendinblue) transactional email integration
uptime Monitor multiple server IPs for uptime/downtime
status Collect the status of every systemd service