ubuntu 开机自启动java服务程序
1.创建shell脚本,chmod 777 ; /data/start-my-ai.sh #!bin/bash sudo fdfs_trackerd /etc/fdfs/tracker.conf start sudo fdfs_storaged /etc/fdfs/storage.conf start sudo /usr/local/nginx/sbin/nginx 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