[ONLY WITH UBUNTU]
I use upstart to run my jar-File as a daemon. Upstart manages the PIDs. Just add myservice.conf to /etc/init (not /etc/inid.d) and the daemon will be started on system start and you can mangage it as a service. You do not have to make the file runnable or anything else.
My Conf-File:
You can handle the service as usual.
Everything you have to do:
- sign in as root or use sudo because you need root privileges
- Create conf-File in "/etc/init" and copy the script into it (the name of the conf-file will be the name of the service)
- change the path to your JTS3ServerMod.jar and the path to your logfile
- change the user who runs this file for example "ts" or "ts3" or something else (for security reasons do not use root !!!)
- now you can start the service "service myservice start"
- the service will be started on system start automatically
If you have a any questions write me an PM (you can write it also in german)
Greetings from Düsseldorf, Germany
I use upstart to run my jar-File as a daemon. Upstart manages the PIDs. Just add myservice.conf to /etc/init (not /etc/inid.d) and the daemon will be started on system start and you can mangage it as a service. You do not have to make the file runnable or anything else.
My Conf-File:
Code Select
description "myservice"
author "your name"
start on runlevel [3]
stop on shutdown
expect fork
script
cd /home/username/
sudo -u username java -jar /home/username/myservice/myservice.jar >/home/username/myservice.log 2>&1
emit myservice_running
end script
You can handle the service as usual.
Code Select
service myservice restart
service myservice status
...
Everything you have to do:
- sign in as root or use sudo because you need root privileges
- Create conf-File in "/etc/init" and copy the script into it (the name of the conf-file will be the name of the service)
- change the path to your JTS3ServerMod.jar and the path to your logfile
- change the user who runs this file for example "ts" or "ts3" or something else (for security reasons do not use root !!!)
- now you can start the service "service myservice start"
- the service will be started on system start automatically
If you have a any questions write me an PM (you can write it also in german)
Greetings from Düsseldorf, Germany