Server cron jobs

Manage and schedule cron jobs from Moss

Server cron jobs are typically used to run system-wide periodic administrative tasks. You can manage them from Moss at the Cron Jobs tab of your server:

When you create a cron job, you must provide the command that will be executed, the server user that will run it, and the schedule of the job. You can edit or delete such cron jobs at any moment right from Moss.

Common commands

You may want to free disk space by removing packages that were automatically installed to satisfy dependencies for other packages but that are no longer needed. For this you can tell Moss to run the following as root

env DEBIAN_FRONTEND=noninteractive apt autoremove -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold'

If you develop PHP applications and use composer to manage dependencies, you may want to update it to the latest version from time to time. In that case, you can use this command in a cron job (run it as root):

composer self-update 2&>1 > /var/log/composer-update.log

Note that such command writes the standard and error output into a log file. This is a very common practice to check whether your command succeeded or not. Just remember that the log file must be in a path where the server user that runs the command has permissions.