SupervisorCTL

SupervisorCTL

Table of Contents

SupervisorCTL

🏰 The Grand Tome of Supervisorctl - A Kingdom’s Guide to Process Mastery 📜

Greetings, noble process warden! Welcome to the mystical art of supervisorctl - the enchanted command-line scepter that grants you dominion over all the daemon spirits dwelling within your server realm! ⚔️✨

🌟 What is This Magical Tool?

Supervisorctl is the command-line interface to Supervisor - a mighty process control system that watches over your background processes like a wise castle guardian. Think of it as your royal steward who ensures all the kingdom’s services keep running, even when dark forces (crashes) threaten the realm! 🛡️

🔮 Basic Incantations (Commands)

📋 View Your Kingdom’s Status

supervisorctl status

Reveals all processes under your dominion - running, stopped, or cursed (failed)

Awakening Sleeping Services

supervisorctl start <program_name>
supervisorctl start all

Breathe life into dormant processes! Use “all” to awaken the entire kingdom at once 🌅

🛑 Commanding Processes to Rest

supervisorctl stop <program_name>
supervisorctl stop all

Gracefully put processes to sleep - they’ll dream until you call them again 😴

🔄 The Phoenix Ritual (Restart)

supervisorctl restart <program_name>
supervisorctl restart all

Kill and resurrect your processes - like a phoenix rising from digital ashes! 🔥🦅

📜 Reading the Ancient Logs

supervisorctl tail <program_name>
supervisorctl tail -f <program_name>  # Follow the mystical stream

Peer into the chronicles of your processes - add -f to watch events unfold in real-time 📖

🏰 Advanced Sorcery

🔮 Reloading the Kingdom’s Constitution

supervisorctl reread    # Discover new configurations
supervisorctl update    # Apply the newfound wisdom

👑 Interactive Throne Room Mode

supervisorctl
# Enters the royal chamber - type commands without the 'supervisorctl' prefix
> status
> start my_app
> quit

🗂️ Managing Process Groups

supervisorctl start web:*     # Awaken all web servants
supervisorctl stop database:* # Rest all database guardians

🛠️ Configuration Scrolls (/etc/supervisor/conf.d/)

Create mystical configuration files ending in .conf:

[program:my_noble_app]
command=/path/to/your/application
directory=/path/to/working/directory
user=app_wizard
autostart=true
autorestart=true
stdout_logfile=/var/log/my_app.log
stderr_logfile=/var/log/my_app_errors.log

🚨 Emergency Battle Commands

When dark forces attack your kingdom:

# The Nuclear Option - restart everything!
supervisorctl restart all

# Check for wounded processes
supervisorctl status | grep FATAL

# Force-kill a rebellious process
supervisorctl stop <stubborn_process>
kill -9 $(ps aux | grep <process> | awk '{print $2}')
supervisorctl start <process>

🎭 Common Kingdom Scenarios

🔍 Debugging a Misbehaving Servant:

supervisorctl status my_app
supervisorctl tail my_app
supervisorctl restart my_app

🌅 Setting Up Auto-Start Magic:

  • Edit your .conf file with autostart=true
  • Run supervisorctl reread && supervisorctl update

📊 Monitoring Your Digital Kingdom:

# The royal status report
supervisorctl status

# Watch the logs like a crystal ball
supervisorctl tail -f my_important_service

🧙‍♀️ Pro Witch Tips

  • 🔮 Use wildcards: supervisorctl restart web:* affects all programs in the “web” group
  • 📝 Log rotation magic: Supervisor can handle log rotation automatically
  • 🛡️ Process resurrection: Set autorestart=true for immortal processes
  • ⚡ Quick updates: After config changes, always reread then update

🎉 Congratulations, Process Master! You now wield the power to command digital spirits across your server kingdom. May your processes run eternal and your logs be ever clear!

Remember: With great supervisorctl power comes great responsibility to keep the realm’s services alive and thriving! 👑✨

Tags :