Skip to main content
Glama
si-service-maintenance1.82 kB
--- schemaVersion: "2.2" description: "Move a running binary into or out of maintenance mode" parameters: Service: type: "String" description: "Service to Run on Node" default: "N/A" InstanceId: type: "String" description: "InstanceId of the executing Node" default: "N/A" Action: type: "String" description: "Set Maintenance Mode from y or n" default: "N/A" mainSteps: - action: "aws:runShellScript" name: "example" inputs: runCommand: - | flip_or_stick() { requested_state=$1 response_code=$(curl -s -o /dev/null -w "%{http_code}" localhost:5156/) [[ "$response_code" == "404" ]] && [[ "$requested_state" == "y" ]] && killall -s USR2 {{ Service }} [[ "$response_code" == "503" ]] && [[ "$requested_state" == "n" ]] && killall -s USR2 {{ Service }} } check_state() { requested_state=$1 response_code=$(curl -s -o /dev/null -w "%{http_code}" localhost:5156/) if [[ "$response_code" == "503" ]] && [[ "$requested_state" == "y" ]]; then echo "{\"instance_id\": \"{{ InstanceId }}\", \"status\": \"success\", \"service\": \"{{ Service }}\", \"mode\": \"maintenance\" }" elif [[ "$response_code" == "404" ]] && [[ "$requested_state" == "n" ]]; then echo "{\"instance_id\": \"{{ InstanceId }}\", \"status\": \"success\", \"service\": \"{{ Service }}\", \"mode\": \"running\" }" else echo "{\"instance_id\": \"{{ InstanceId }}\", \"status\": \"failure\", \"service\": \"{{ Service }}\", \"mode\": \"Status code from API not valid for requested action. Response Code: $response_code, Maintenance Mode Requested: {{ Action }}\" }" fi } flip_or_stick {{ Action }} check_state {{ Action }}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server