1.创建shell脚本
chmod 777 ; /data/start-my-ai.sh
#!bin/bash
# fastdfs文件存储
sudo fdfs_trackerd /etc/fdfs/tracker.conf start
sudo fdfs_storaged /etc/fdfs/storage.conf start
# nginx
sudo /usr/local/nginx/sbin/nginx
# 加载java依赖
export JAVA_HOME=/usr/local/jdk1.8
export CLASSPATH=.:$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
nohup java -jar /data/my-pro/my-ai-1.0.jar >/data/my-pro/my-ai.log 2>&1 &
2. 配置 /etc/.rc.local
ubuntu@ubuntu:/etc$ cat rc.local
#!/bin/sh -e
#
# rc.local
#
sudo /data/cnbmtech-pro/start-my-ai.sh &
exit 0