[Unit] Description=yourProjectName #描述 After=syslog.target network.target #依赖
[Service] Type=simple
ExecStart=/usr/bin/java -jar /opt/javaapps/yourProjectName.jar #前面是java命令的绝对路径 后面是jar包的绝对路径 ExecStop=/bin/kill -15 $MAINPID
User=root Group=root
[Install] WantedBy=multi-user.target
|