Azure VM Issue Fixing
1. Optimize Application and Server Configuration
- Step 1: Identify the Main Python File
bashCopy codecd /home/soundarya/my_app # Replace with your actual application directory
bashCopy codels *.py
Step 2: Update the Check ScriptbashCopy codenano check_app.sh
bashCopy code#!/bin/bash # Check if the Python application is running if ! pgrep -f "python /home/soundarya/my_app/app.py" > /dev/null; then echo "Application not running, starting it..." nohup python /home/soundarya/my_app/app.py & # Update with your actual app path fi
Step 3: Make the Script ExecutablebashCopy codechmod +x check_app.sh
Step 4: Set Up a Cron JobbashCopy codecrontab -ebashCopy code*/5 * * * * /home/soundarya/check_app.sh # Replace with your actual script path
2.Scheduled MaintenancebashCopy code0 2 * * * /path/to/restart_app.sh # Restart at 2 AM every day
Last updated