This article shows how to Set the cron automate the jobs.
It involves logging into the server via SSH to run several commands.
The crontab files are where the lists of jobs and other instructions to the cron daemon are kept.
Each user at DreamHost has their own individual crontab file that can be accessed by running the following command under your Shell user:
[server]$ crontab -e
- Crontab files are simple text files that have a particular format.
- Each line of a crontab file follows a particular format as a series of fields, separated by spaces and/or tabs.
- Each field can have a single value or a series of values.
- A single cron job should take up exactly one line, but this can be a long line (more than 80 characters).
Things to look out for when editing/creating your crontab.
- Each line has five time/date fields, followed by a command, followed by a newline character (‘\n’).
- A common problem is not including a newline, so hit ‘Enter/Return’ a time or three at the end of your command.
- Another common problem is automatic word-wrap breaking up a long line into multiple lines, so make sure your text editor doesn’t do this.
- Blank lines and leading spaces and tabs are ignored.
- Lines whose first non-space character is a hash-sign (#) are ignored as they are considered comments.
- Note that comments are not allowed on the same line as cron commands.
- Since they are interpreted as being part of the command.
- Similarly, comments are not allowed on the same line as environment variable settings (like MAILTO).
- Here we read about how to cron automates jobs.
There are two ways to create custom cron jobs.
- Editing the existing crontab on the server.
- Using a custom crontab file.
If you’ve edited the existing crontab.
- If you have already created a cron job in your panel.
- You can view it by running crontab -e under your Shell user.
- If you edit the file to add another cron job below the existing panel one, the panel cron job will continue to function normally in addition to your new edited code.
- Any adjustments in the panel will not affect your custom code.
If you switched the server’s crontab with your custom crontab.
- You can also use a custom crontab that you created. If you do this, the server’s crontab is overwritten. You can replace the server’s crontab by running the following:
[server]$ crontab /home/username/crontab
now. Read More