1./etc/init.d/下新建脚本 autoJar.sh 名字任意
2.一定要在命令上加上这段否则报错
#!/bin/sh
### BEGIN INIT INFO
# Provides: autoJar.sh
# Required-start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the svnd.sh daemon
# Description: starts svnd.sh using start-stop-daemon
### END INIT INFO
export JAVA_HOME=/usr/lib/jdk/jdk1.8
export PATH=${JAVA_HOME}/bin:$PATH
cd /usr/printer
java -jar zwpp-0.0.1-SNAPSHOT.jar &
3.设置文本权限,否则不生效
$ sudo chmod 755 /etc/init.d/autoJar.sh
4.将命令脚本添加到启动脚本中去
$ cd /etc/init.d
$ sudo update-rc.d svnd.sh defaults 90
注:90代表启动脚本的先后顺序
5.reboot重启生效测试
6.卸载启动脚本
$ cd /etc/init.d
$ sudo update-rc.d -f autoJar.sh remove