5ddbde3310
* adds kolide fleet * integrates osquery to kolide fleet server Change-Id: I646364c44bb99d4397bb35068600c49b7bfd62c2
70 lines
1.5 KiB
Django/Jinja
70 lines
1.5 KiB
Django/Jinja
#!/usr/bin/env bash
|
|
|
|
###############
|
|
# SysV Init Information
|
|
# description: docker daemon.
|
|
### BEGIN INIT INFO
|
|
# Provides: me
|
|
# Required-Start:
|
|
# Required-Stop:
|
|
# Default-Start: 2 3 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: manage docker daemon
|
|
# Description: docker daemon
|
|
### END INIT INFO
|
|
|
|
|
|
HOME=path/to/code
|
|
EXEC=docker
|
|
NAME="redis_service"
|
|
|
|
LABEL={{ kolide_fleet_version }}
|
|
|
|
case "$1" in
|
|
start)
|
|
RUNNING=`docker inspect -f '{{.State.Running}}' ${NAME}`
|
|
|
|
if [[ ${RUNNING} == "true" ]]; then
|
|
#
|
|
# No need to start it
|
|
#
|
|
echo "Process is running"
|
|
exit 1;
|
|
if
|
|
echo "Starting container: '$NAME'..."
|
|
docker run -d --restart=always --name=redis_service redis:4-alpine
|
|
;;
|
|
stop)
|
|
echo "Stopping $NAME..."
|
|
|
|
docker stop -t 2 ${NAME} &> /dev/null
|
|
|
|
if [[ 0 != $? ]]; then
|
|
echo "Could not stop container"
|
|
exit 4;
|
|
fi
|
|
;;
|
|
status)
|
|
RUNNING=`docker inspect -f '{{.State.Running}}' ${NAME}`
|
|
|
|
if [[ "true" == ${RUNNING} ]]; then
|
|
echo "$NAME is running"
|
|
else
|
|
echo "$NAME is not running"
|
|
fi
|
|
;;
|
|
inspect)
|
|
docker inspect ${NAME}
|
|
;;
|
|
logs)
|
|
docker logs ${NAME}
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
;;
|
|
*)
|
|
echo "Please use start, stop, restart, inspect or status as first argument"
|
|
;;
|
|
esac
|