Skip to main content

Command Palette

Search for a command to run...

Automation In Shell Script

Published
1 min read
B

I am DevOps Engineer who works on DevOps tools like Docker, Kubernetes, Terraform, Git, GitHub, Jenkins and AWS services.

-> We can automate our shell script using two ways

Using AT command

-> Using at command we can automate the script if we have to run one time.

at <time>

<command> Ex- bash <path of the script>

ctrl+d

#!/bin/bash

echo "We are checking the at automation" >> redirect.log

-> Here we are saving the logs in a redirect.log file

-> To see all the job-

run atq

-> To remove the scheduled job

atrm <id>

Using Crontab Command

-> To check the existing jobs - crontab -l

-> To add a new job - crontab -e

* * * * * cd /home/ubuntu && bash at_test.sh

More from this blog

Bhaskar Mehta's blog

21 posts