linux下springboot项目 使用rc.local自启动时不加载自己指定的配置文件
- 项目文件全部在/biz目录下
脚本名称restart_boot.sh
#参数配置
BaseDir=/biz
JarName=$BaseDir/VisitorSystem.jar
LogsPatch=$BaseDir/logs_$Port
#启动脚本
nohup java -jar -Dlogging.path=$LogsPatch $JarName --spring.config.location=$BaseDir/application-pro.yml --spring.profiles.active=pro >$LogsPatch/catlina.out 2>&1 &
- 直接运行该脚本没问题,但是放到/etc/rc.d/rc.local里边自动启动就不会加载/biz/application-pro.yml这个配置文件
rc.local里边
#添加了这么一行
sh /biz/restart_boot.sh