Files
codefever/misc/codefever-service-template
Carney Wu d3de96487f initial version (#1)
* fix(Useless Code): remove useless code

* feat(Deploy Scripts): add deploy scripts

* fix(Delopy Script): change settings

* fix(Deploy Script): fix ssh-keygen script

* fix(Deploy Script): change env file path

* feat(Deploy Script): add db migration

* fix(Deploy script): change script

* feat(Deploy Script): add sql file to create database

* fix(Deploy Script): add composer support

* fix(Deploy Script): add composer

* fix(Service Script): add http gateway

* fix(Deploy Script): add git path

* fix(Deploy Script): fix setting bugs

* fix(Init Script): get user from config

* fix(Service): adjust run users

* feat(Doc): add doc

* fix(Doc): change docs

* fix(Deploy script): change owner of storage path

* feat: codefever-community documentation system

* fix(Doc): doc details page style

* feat: fix page navigation

* fix(SQL File): fix db file fit MySQL 5.7

* fix(FileTree): empty repository display

* fix: fix helper navigation

* docs(zh-cn essential part):

* fix(Doc Style): change markdown.css

* docs(contribution doc):

* fix: unified page style

* docs(Readme): add readme

* build(Build):

Co-authored-by: cubic <carneywu@pgyer.com>
Co-authored-by: pololi <pololi@pgyer.com>
Co-authored-by: yangchen <chenyang@pgyer.com>
2022-01-19 17:21:59 +08:00

94 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# chkconfig: 2345 50 20
BASE=/data/www/codefever-community
PHP=/usr/local/php/bin/php
SRC=$BASE/misc/modify_authorized_keys.php
SCRIPTNAME=$BASE/misc/modify_authorized_keys
DESC="modify_authorized_keys_shell_running"
PID=`ps -ef | grep -v awk | awk '/'$DESC'/{print $2}'`
HTTP_GATEWAY=$BASE/http-gateway/main
HTTP_GATEWAY_PID=`ps -ef | grep -v awk | awk '/'http-gateway'/{print $2}'`
GIT_USER=`cat $BASE/env.yaml | grep git: | tail -n 1 | awk -F: '{ print $2 }' | sed 's/^\s*//'`
start()
{
if [[ -z "$PID" ]] ;then
echo "Starting service: SSH authorized key sync ..."
nohup $PHP $SRC $DESC > /dev/null 2>&1 &
fi
echo "Service started: SSH authorized key sync"
if [[ -z "$HTTP_GATEWAY_PID" ]] ;then
echo "Starting service: SSH authorized key sync ..."
nohup sudo -u $GIT_USER $HTTP_GATEWAY > /dev/null 2>&1 &
fi
echo "Service started: HTTP gateway"
exit 0;
}
stop()
{
echo "Shutting down service: SSH authorized key sync ..."
for var in $PID
do
result=`kill -KILL $var 2>&1`
if [[ -n "$result" ]] ;then
echo $result
fi
done
echo "Service stopped: SSH authorized key sync"
echo "Shutting down service: HTTP gateway ..."
for var in $HTTP_GATEWAY_PID
do
result=`kill -KILL $var 2>&1`
if [[ -n "$result" ]] ;then
echo $result
fi
done
echo "Service stopped: HTTP gateway"
exit 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
if [[ -n "$PID" ]] ;then
echo "SSH authorized key sync: Running ..."
else
echo "SSH authorized key sync: Stopped ..."
fi
if [[ -n "$HTTP_GATEWAY_PID" ]] ;then
echo "HTTP gateway: Running ..."
else
echo "HTTP gateway: Stopped ..."
fi
exit 0
;;
*)
echo "Usage: start|stop|restart|status"
;;
esac
exit 0