Answer for KodeKloud Question - Create a Cron Job

 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.

Sample Answer:

ssh <user>@<server>

#Swithc to root user
sudo su 

# Install the cronie package
        yum install cronie

#Start the crond service 
         systemctl start crond.service 

#Check cron service status 
        systemctl status crond.service

.#Create a cronjob by typing 
        crontab -e

 #Write the cron job  (press "i" to change the insert mode then paste below command then type "Esc" :wq!)

        */5 * * * * echo hello  >  /tmp/cron_text

 #Check cron job 
        crontab -l

#Check cron job for root 
        crontab -u root -l

Note: **The Question copied it for learning purposes.** Commands are correct but based on your question the server, user name, and other details might differ, so please do check.



No comments:

Post a Comment

Featured Post

Answer for Kodekloud DEVOPS Questions - Init container in Kubernetes

Question: 1. Create a Deployment named as ic-deploy-devops. 2. Configure spec as replicas should be 1 , labels app should be ic-devops , ...