Problem Statement
Describe a practical scenario where if-else is used in a deployment script.
Explanation
If-else statements help control execution flow based on conditions. For example, checking if a service is running before restarting it.
This prevents unnecessary downtime or duplicate operations in automation scripts.
Code Solution
SolutionRead Only
if systemctl is-active --quiet nginx; then echo 'Nginx is running' else systemctl start nginx fi