cpu_physicals=$(cat /proc/cpuinfo|grep "physical id"|sort|uniq|wc -l)
cpu_cores=$(cat /proc/cpuinfo|grep "core id"|sort|uniq|wc -l)
cpu_processes=$[${cpu_physicals} * ${cpu_cores}]
echo processes ${cpu_processes}
cpu_threads=$(grep -c 'processor' /proc/cpuinfo)
echo threads ${cpu_threads}
ps ax|grep "0.0.0.0:8000"|grep -v grep|awk '{print $1}'|xargs kill -8
sleep 1
nohup uwsgi --http-socket 0.0.0.0:8000 --chdir /var/www/ --wsgi-file x/wsgi.py --uid $user --gid $user --master --processes $cpu_processes --threads $cpu_threads &