目录

django程序在centos等linux系统下开机启动

目录

django程序在centos等linux系统下开机启动

#!/bin/sh
#chkconfig:2345 80 90
#description:scrs_backend

#firt 3 row must needed,if not,chkconfig has errors
#auto start steps:
#1.create sh file such this file(egg:scrs_backend.sh)
#2.copy auto start file to “/etc/rc.d/init.d”
#3.add authoritys throuth cmd,must check authority

 chmod +x /etc/rc.d/init.d/scrs_backend.sh

#4.add to auto startup

 cd /etc/rc.d/init.d

 chkconfig –add scrs_backend.sh

 chkconfig scrs_backend.sh on

#4.other commands

 chkconfig –list

#because jdk enviment started after /etc/profile,so source these files first
source /etc/profile
source /opt/apps/anaconda3/etc/profile.d/conda.sh

#########spark auto start,copy from spark start file “start-all.sh”
if [ -z “${SPARK_HOME}” ]; then
  export SPARK_HOME="$(cd “dirname "$0"”/..; pwd)"
fi

Load the Spark configuration

. “${SPARK_HOME}/sbin/spark-config.sh”

Start Master

“${SPARK_HOME}/sbin”/start-master.sh

Start Workers

“${SPARK_HOME}/sbin”/start-workers.sh

##################django auto start
cd /data/scrsapp_apache/scrs_backend_rest_service
conda activate env_django
python manage.py runserver 0.0.0.0:3000 &