Skip to content

Latest commit

 

History

History
executable file
·
73 lines (46 loc) · 1.67 KB

TASK_4-Create_a_Cron_Job.md

File metadata and controls

executable file
·
73 lines (46 loc) · 1.67 KB

Start:         2023-08-06 23:50:23
Finished:   2023-08-06 23:54:52



TASK 004: Create a Cron Job

Requirements

The Nautilus system admins team has prepared scripts to automate several day-to-day tasks. They want them to be deployed on all app servers in Stratos DC on a set schedule. Before that they need to test similar functionality with a sample cron job. Therefore, perform the steps below:

a. Install cronie package on all Nautilus app servers and start crond service. b. Add a cron */5 * * * * echo hello > /tmp/cron_text for root user.


Steps

Login to the app server 1 and switch to root. For the server credentials, check out the Project Nautilus documentation.

sshpass -p  '******' ssh -o StrictHostKeyChecking=no [email protected]
sudo su -

Install cronie and start.

sudo yum install -y cronie
sudo systemctl start crond

Modify the cron file for the root.

$ sudo crontab -e

# then add this to the file
*/5 * * * * echo hello > /tmp/cron_text

To verify:

sudo crontab -l -u root
sudo systemctl status crond

Restart the service Check if a cron job is created for the root user in cron directory.

sudo systemctl restart crond
sudo ls /var/spool/cron
sudo cat /var/spool/cron/root  

Repeat the same steps for app server 2 and 3.


Resources