Quick commands

This summary of the commands helps to administer cronjobs better.

List cronjobs

With the following command you can list all current cronjobs. This command lists all jobs in the current users scope.

crontab -l

You can specify the parameter "-u" and add a username to list the cronjobs of a different user. Or with sudo you can list the jobs of the root user.

crontab -u luca -l

Edit cronjobs

With the flag "-e" you can edit the current users cronjob file. If you run this the first time you have to select your editor. The simplest editor is the first called "nano".

crontab -e

Add new cronjob

To add a new cronjob you have to edit the configuration file with the following command.

crontab -e

Then you can paste the description into the config file. A cronjob description contains the following values:

<regularity> <command to be executed> >> <logfilepath> 2>&

Example:

* * * * * /bin/bash /home/luca/cronjob/backuplncappsdb.sh >> /home/luca/cronjob/backuplncappsdb.log 2>&1

Regularity

The regularity of the executions is described with a special syntax at the beginning of the configuration line. More information about describing the regularity is described here:

Configure cron job schedules  |  Cloud Scheduler Documentation  |  Google Cloud


Revision #3
Created 11 January 2023 14:49:52 by Luca Noah Caprez
Updated 11 January 2023 15:30:25 by Luca Noah Caprez