redmine的启动脚本

Docker守护进程和名字
docker run –name=redmine -it -d
————–

#!/bin/sh
 
mode=$1
 
dockerd_current=`ps -ef | grep "dockerd-current"| grep -v grep`
portainer=`ps -ef | grep "/redmine/redmine/config/unicorn.rb"| grep -v grep`
 
case "$mode" in
   'start')
	echo "it's ready to start op...."
	if test -n "$dockerd_current"; then
		echo "---the docker.service had already started.."
	else
		`sudo systemctl start docker.service`
	fi
 
	if test -n "$portainer"; then
		echo "---the portainer had already started.."
	else
		`sudo docker stop /redmine`
		`sudo docker rm /redmine`
		`sudo docker run --name=redmine -it -d --env='DB_ADAPTER=mysql2' --publish=10083:80 --env='REDMINE_PORT=10083' --env='DB_HOST=192.168.11.130' --env='DB_NAME=redmine_production'  --env='DB_USER=redmine' --env='DB_PASS=123456' --volume=/srv/docker/redmine/redmine:/home/redmine/data sameersbn/redmine:3.4.2`
	fi
	echo 'success to start.'
	echo '---1--you can test redmine by way bellow----'
	echo 'http://localhost:10083'
	echo 'user:admin   password:123456'
	;;
   'stop')
	echo "it's ready to check process..."
	`sudo systemctl stop docker.service`
	echo 'success to kill.'
	;;
    *)
	basename=`basename "$0"`
	echo "Usage: $basename  {start|stop}  [ server options ]"
	exit 1
	;;
esac
exit 1