Buat sebuah Service
sudo nano /etc/systemd/system/myjava.service
Copy/paste kode berikut ini ke dalam file myjava.service
[Unit] Description=My Java Service [Service] User=ubuntu # The configuration file application.properties should be here: #change this to your workspace WorkingDirectory=/home/ubuntu/workspace #path to executable. #executable is a bash script which calls jar file ExecStart=/home/ubuntu/workspace/start SuccessExitStatus=143 TimeoutStopSec=10 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target
Buat file Bash Script untuk memanggil Service
nano /home/ubuntu/workspace/start
Copy/paste kode berikut:
#!/bin/sh /usr/bin/java -jar myjava.jar
Start Service
sudo systemctl enable myjava.service sudo systemctl start myjava.service






Users Today : 276
Users Yesterday : 402
This Month : 2737
This Year : 84761
Total Users : 149248
Views Today : 1930
Total views : 669124
Who's Online : 1
Recent Comments