[PLUG] service in systemd not starting custom java app after rebooting RHEL 7.4

Amey Abhyankar sco1984 at gmail.com
Wed Jul 4 14:42:13 IST 2018


Hello,

I am trying to create a service inside /etc/systemd/system & it's
softlink in /etc/systemd/system/multi-user.target.wants but it's not
helping.

After system reboot, if I do ps -ef |grep -i javaapp it's not started.

Can somebody suggest best practices to make custom java application as
a service using systemd?

My current config of service as follows =
I copied mongodb conf file and created new service using appropriate parameters.

------------------------------------------------------
[Unit]
Description=javaapp service
After=network.target

[Service]
User=user1
Group=user1
#Environment="OPTIONS=-f /etc/mongod.conf"
ExecStart=/opt/user1/javaapp1/current/javaapp.sh $OPTIONS
#ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb
#ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb
#ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb
PermissionsStartOnly=true
PIDFile=/opt/user1/javaapp1/current/javaapp.pid
Type=forking
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false

[Install]
WantedBy=multi-user.target

------------------------------------------------------

Regards,
Amey.


More information about the plug-mail mailing list