Cron is a program that enables Unix users to execute commands or scripts automatically at specified times and dates. Cron is a daemon, which means that it only needs to be started once and will then lay dormant until it is required. To specify when you want cron to execute particular jobs you need to give it instructions. The way this is done is through editing a cron config file or crontabs.
On Linux cron is generally automatically installed and opened on startup of the computer. Each username on a computer will have its own crontab which can be edited and will allow that user to automate jobs on the computer.
To view the crontab for your username on your current computer type
crontab -e
This should open an empty file (assuming that this is a clean install of centos 7 as advised) once open, edit the crontab by entering the lines below (remembering to change the path of the SAFNWC variable to match the location of your safnwc directory and the SAFNWC environment variable in your .bashrc file).
CRON_TZ=UTC
SAFNWC=/full/path/to/safnwc/directory
The first line specifies that all the times will use Coordinated Universal Time (UTC) rather than local time. The second line defines your SAFNWC environment variable. The second line is necessary because your crontab runs in a different shell to your normal console. As such it does not share the environment variables for your bash shell that you set up earlier.
When entering a job to be automated to your crontab it will look something like this (so not enter this to your crontab)
15 10 1 2 * /bin/bash -c "/full/path/to/script/example.sh"
where the numbers (and stars * as placeholders) represent the control of when a command will be executed. In this example the script would be run on 15th minute of the 10th hour of the first day of the second month every year. A star in every location means a command would run for every minute of every hour of every day of every month. The 5th place can be used to specify running jobs on particular days of the week. A helpful guide is shown below.
* * * * * command to execute
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of week (0 - 6, Sunday to Saturday, or use names)
│ │ │ └────────── month (1 - 12)
│ │ └─────────────── day of month (1 - 31)
│ └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)
There is a huge number of ways in which job initiation times and dates can be specified. A website that I find very useful is https://crontab.guru/ which simply explains what each column does and allows you to input example time controls and see in both plain text and numerical time/dates when a job with that crontab entry would be executed.
The second part of the example line above indicates the command that you want to be executed. In this case using bash to execute the script example.sh. The command here doesn't have to be a script but it is often a good idea to write a script that contains a number of commands and initiate them using a single line in your crontab.
Your crontab will automatically open to be edited in vim.