Skip to content

Instantly share code, notes, and snippets.

@callingmedic911
Created April 24, 2022 14:49
Show Gist options
  • Save callingmedic911/7c37b320eb7798ceff3ac788ddf0cdad to your computer and use it in GitHub Desktop.
Save callingmedic911/7c37b320eb7798ceff3ac788ddf0cdad to your computer and use it in GitHub Desktop.
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Docker
# @raycast.mode compact
# Optional parameters:
# @raycast.icon images/docker.png
# @raycast.argument1 { "type": "text", "placeholder": "cmd" }
# @raycast.packageName Aditya Pandey
# Documentation:
# @raycast.description Wrapper aroung pg_ctl
# @raycast.author Aditya Pandey
# @raycast.authorURL twitter.com/callingmedic911
start_docker () {
# Open Docker, only if is not running
if (! docker stats --no-stream &> /dev/null); then
# On Mac OS this would be the terminal command to launch Docker
open /Applications/Docker.app
# Wait until Docker daemon is running and has completed initialisation
while (! docker stats --no-stream &> /dev/null); do
# Docker takes a few seconds to initialize
echo "Waiting for Docker to launch..."
sleep 1
done
fi
}
stop_docker () {
# Kill Docker, only if is running
if (docker stats --no-stream ); then
# On Mac OS this would be the terminal command to launch Docker
pkill -SIGHUP -f /Applications/Docker.app 'docker serve'
fi
}
if [[ "$1" == "start" ]]; then
start_docker
fi
if [[ "$1" == "stop" ]]; then
stop_docker
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment