I am need of running series of commands after checking the conditions. I tried this
#var1 results in output active or inactive
var1= systemctl is-active docker
#Function for enabling and running the docker service
function run {
echo "Starting Docker service.."
sudo systemctl enable docker
sudo systemctl start docker
mkdir /mnt/new/hello_test
}
# Checking whether the docker service is up or not
if [[ $var1 -eq inactive ]]
then
echo "$(run)"
else
echo "Docker service is running..." ; touch /mnt/new/testingg;
fi
In this script, it is only checking 1st condition. ANy help would be appreciated. Thanks!
Aucun commentaire:
Enregistrer un commentaire