Created
September 15, 2024 16:57
-
-
Save NamesMT/0708cc223a3db878df0477159115a49b to your computer and use it in GitHub Desktop.
Custom docker service start stop script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BASE=docker | |
DOCKERD=/usr/bin/dockerd | |
# This is the pid file managed by docker itself | |
DOCKER_PIDFILE=/var/run/$BASE.pid | |
# This is the pid file created/managed by start-stop-daemon | |
DOCKER_SSD_PIDFILE=/var/run/$BASE-ssd.pid | |
DOCKER_LOGFILE=/var/log/$BASE.log | |
DOCKER_OPTS= | |
DOCKER_DESC="Docker" | |
if [ "$1" = "stop" ]; then | |
echo "stopping docker..." | |
sudo start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" | |
elif ! pgrep "dockerd" >/dev/null; then | |
echo "starting docker..." | |
sudo start-stop-daemon --start --background \ | |
--exec "$DOCKERD" \ | |
--pidfile "$DOCKER_SSD_PIDFILE" \ | |
--make-pidfile \ | |
-- \ | |
-p "$DOCKER_PIDFILE" \ | |
$DOCKER_OPTS | |
#>> "$DOCKER_LOGFILE" 2>&1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment