Skip to content

Instantly share code, notes, and snippets.

@jlcarruda
Created May 17, 2023 14:11
Show Gist options
  • Save jlcarruda/bd6463fdcee525211901db6f39fb4333 to your computer and use it in GitHub Desktop.
Save jlcarruda/bd6463fdcee525211901db6f39fb4333 to your computer and use it in GitHub Desktop.
Check if tmux and docker service is running
MAIN_TMUX_SESSION="$(tmux ls | awk '{print substr($1, 1, length($1)-1)}')"
if [[ -z $MAIN_TMUX_SESSION ]] then
/usr/bin/tmux new-session -s main;
#else
# /usr/bin/tmux attach -t main;
fi
# Check if docker service is running
IS_DOCKER_RUNNING="$(service docker status | grep 'Docker is running')"
if [[ -z $IS_DOCKER_RUNNING ]]; then
printf "Starting docker ...\n"
sudo /usr/sbin/service docker start
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment