`
Backups, commands, and scripts can be run on a schedule using cron.
The command 'crontab -e' will open the selected editor to edit the cron file. The selected editor can be changed at any time.
crons can be set up to run by minute, hour, day of month, month, and day of week.
When a cron job runs on an Ubuntu system, the file /var/log/syslog is updated
The output from a cron can be redirected to directory in a home directory
We schedule a cron job to run a backup once a week
We update output file names for the cron created in the last video to include the date the cron was run in the output files.
We then create a cron to sync two directories ever minute.
We then look at where the crontab files a located and how a privileged user can update another users crontab file by adding -u and the userID of the crontab file to be edited.
We then look at how cron.deny and cron.allow work
Anacron is useful for scheduling a job to run on a computer that is turned off regularly.
Only privileged users can schedule an anacron job. Anacron jobs are scheduled in time frames of hourly, daily, weekly, or monthly.
If a computer is not powered on at the time a cron job is scheduled, that cron will be missed and will not run.
If a computer is not powered on when an anacron job is scheduled to run, the next time that computer boots up, anacron will check to see if the scheduled anacron jobs need to run.
To schedule a job to run a single time in the future, we would us "at". It is called "at" because that job is scheduled to run "at" a specific single time.
At does need to be installed Linux Mint computer used in this video and a few moments spent on how to start, stop and enable a service.
We then look at how to schedule an "at" job, how to see what "at" jobs are scheduled, what commands are in our scheduled "at" jobs, and how to remove an "at" job from the "at" queue.
The systemd.timer needs 3 things:
A script to run
A systemd.service to run the script
A systemd.timer to run the systemd.service at the time the script should run
In this video we will create the script and systemd.service files and look at how to run the systemd.service
In the next video, we will write the systemd.timer and run it
In this video, we create and run systemd.timer file to run the systemd.service and script created in the previous video at a specific time.
We then create second script, systemd.service, and systemd.timer file to run a few minutes after the computer boots up.