Skip to content

Commit

Permalink
[Update] 启动脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuler committed Jan 19, 2019
1 parent c8d007f commit 384cdfb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 2 additions & 3 deletions apps/jumpserver/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
PROJECT_DIR = os.path.dirname(BASE_DIR)
CONFIG = load_user_config()
LOG_DIR = os.path.join(PROJECT_DIR, 'logs')
HOSTNAME = socket.gethostname()
JUMPSERVER_LOG_FILE = os.path.join(LOG_DIR, 'jumpserver-{}.log'.format(HOSTNAME))
ANSIBLE_LOG_FILE = os.path.join(LOG_DIR, 'ansible-{}.log'.format(HOSTNAME))
JUMPSERVER_LOG_FILE = os.path.join(LOG_DIR, 'jumpserver.log')
ANSIBLE_LOG_FILE = os.path.join(LOG_DIR, 'ansible.log')

if not os.path.isdir(LOG_DIR):
os.makedirs(LOG_DIR)
Expand Down
7 changes: 6 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@ function cleanup()
fi
}

service="all"
if [ "$1" != "" ];then
service=$1
fi

trap cleanup EXIT
python jms start all
python jms start $service
4 changes: 3 additions & 1 deletion jms
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def is_running(s, unlink=True):
def parse_service(s):
if s == 'all':
return all_services
elif "," in s:
return [i.strip() for i in s.split(',')]
else:
return [s]

Expand Down Expand Up @@ -316,7 +318,7 @@ if __name__ == '__main__':
)
parser.add_argument(
"service", type=str, default="all", nargs="?",
choices=("all", "gunicorn", "celery", "beat"),
choices=("all", "gunicorn", "celery", "beat", "celery,beat"),
help="The service to start",
)
parser.add_argument('-d', '--daemon', nargs="?", const=1)
Expand Down

0 comments on commit 384cdfb

Please sign in to comment.