Hi… i recently started working with linux and i still have some doubts…
i need some help to configure my glassfish 4… i need it to start with the system, like a “system service”…
what’s the best(right) way to do this?
the command-line to start the application is:
/usr/local/Glassfish/glassfish/bin asadmin start-domain
thanks for your attention
PedroGarcia90:
Hi… i recently started working with linux and i still have some doubts…
i need some help to configure my glassfish 4… i need it to start with the system, like a “system service”…
what’s the best(right) way to do this?
the command-line to start the application is:
/usr/local/Glassfish/glassfish/bin asadmin start-domain
thanks for your attention
Hi
There is an example of a glassfish systemd service file here;
Just like in the above link, save to /etc/systemd/system.
I tried that … but i’m gettin a error…
this is what i’ve done…
linux-wcz5:/home/pedrogarcia # cat > /etc/systemd/system/glassfish.service
[Unit]
Description = GlassFish Server v4.1
After = syslog.target network.target
[Service]
User=linux-wcz5
ExecStart = /usr/local/Glassfish/glassfish/bin asadmin start-domain
ExecStop = /usr/local/Glassfish/glassfish/bin asadmin stop-domain
ExecReload = /usr/local/Glassfish/glassfish/bin asadmin restart-domain
Type = forking
[Install]
WantedBy = multi-user.target
linux-wcz5:/home/pedrogarcia # systemctl enable glassfish.service
linux-wcz5:/home/pedrogarcia # systemctl start glassfish.service
Job for glassfish.service failed. See “systemctl status glassfish.service” and “journalctl -xn” for details.
linux-wcz5:/home/pedrogarcia # systemctl status glassfish.service
glassfish.service - GlassFish Server v4.1
Loaded: loaded (/etc/systemd/system/glassfish.service; enabled)
Active: failed (Result: exit-code) since Ter 2016-02-02 12:40:58 BRST; 3s ago
Process: 10887 ExecStart=/usr/local/Glassfish/glassfish/bin asadmin start-domain (code=exited, status=217/USER)
Fev 02 12:40:58 linux-wcz5 systemd[10887]: Failed at step USER spawning /usr/local/Glassfish/glassfish/bin: No such process
Fev 02 12:40:58 linux-wcz5 systemd[1]: Failed to start GlassFish Server v4.1.
I tried that … but i’m gettin a error…
this is what i’ve done…
**linux-wcz5:/home/pedrogarcia #**** cat > /etc/systemd/system/glassfish.service
[Unit]
Description = GlassFish Server v4.1
After = syslog.target network.target
[Service]
User=linux-wcz5
ExecStart = /usr/local/Glassfish/glassfish/bin asadmin start-domain
ExecStop = /usr/local/Glassfish/glassfish/bin asadmin stop-domain
ExecReload = /usr/local/Glassfish/glassfish/bin asadmin restart-domain
Type = forking
[Install]
WantedBy = multi-user.target
**linux-wcz5:/home/pedrogarcia #**** systemctl enable glassfish.service
**linux-wcz5:/home/pedrogarcia #****** systemctl start glassfish.service
Job for glassfish.service failed. See "systemctl status glassfish.service" and "journalctl -xn" for details.
**linux-wcz5:/home/pedrogarcia #****** systemctl status glassfish.service
glassfish.service - GlassFish Server v4.1
Loaded: loaded (/etc/systemd/system/glassfish.service; enabled)
Active: **failed****** (Result: exit-code) since Ter 2016-02-02 12:40:58 BRST; 3s ago
Process: 10887 ExecStart=/usr/local/Glassfish/glassfish/bin asadmin start-domain **(code=exited, status=217/USER)******
Fev 02 12:40:58 linux-wcz5 systemd[10887]: **Failed at step USER spawning /usr/local/Glassfish/glassfish/bin: No such process******
Fev 02 12:40:58 linux-wcz5 systemd[1]: **Failed to start GlassFish Server v4.1.******
Hi
You missing the trailing / after bin and added a space, it should be;
[Service]
User=linux-wcz5
ExecStart = /usr/local/Glassfish/glassfish/bin/asadmin start-domain
ExecStop = /usr/local/Glassfish/glassfish/bin/asadmin stop-domain
ExecReload = /usr/local/Glassfish/glassfish/bin/asadmin restart-domain
malcolmlewis:
Hi
You missing the trailing / after bin and added a space, it should be;
[Service]
User=linux-wcz5
ExecStart = /usr/local/Glassfish/glassfish/bin/asadmin start-domain
ExecStop = /usr/local/Glassfish/glassfish/bin/asadmin stop-domain
ExecReload = /usr/local/Glassfish/glassfish/bin/asadmin restart-domain
when i run :
/usr/local/Glassfish/glassfish/bin/asadmin start-domain
on command-line, it works fine…
But inside the file still getting the same error
Code:
linux-wcz5:/home/pedrogarcia # cat > /etc/systemd/system/glassfish.service[Unit]
Description = GlassFish Server v4.1
After = syslog.target network.target
[Service]
User=linux-wcz5
ExecStart = /usr/local/Glassfish/glassfish/bin/asadmin start-domain
ExecStop = /usr/local/Glassfish/glassfish/bin/asadmin stop-domain
ExecReload = /usr/local/Glassfish/glassfish/bin/asadmin restart-domain
Type = forking
[Install]
WantedBy = multi-user.target
linux-wcz5:/home/pedrogarcia # systemctl enable glassfish.service
linux-wcz5:/home/pedrogarcia # systemctl start glassfish.service
Job for glassfish.service failed. See "systemctl status glassfish.service" and "journalctl -xn" for details.
linux-wcz5:/home/pedrogarcia # systemctl status glassfish.service
glassfish.service - GlassFish Server v4.1
Loaded: loaded (/etc/systemd/system/glassfish.service; enabled)
Active: failed (Result: exit-code) since Ter 2016-02-02 12:55:24 BRST; 4s ago
Process: 11473 ExecStart=/usr/local/Glassfish/glassfish/bin/asadmin start-domain (code=exited, status=217/USER)
Fev 02 12:55:24 linux-wcz5 systemd[1]: Failed to start GlassFish Server v4.1.
Hi
So is the file asadmin a binary file or a script?
Are the files owned by user linux-wcz5, why not user glassfish (which I’m guessing is a bin/false user since it’s a system service)?
malcolmlewis:
Hi
So is the file asadmin a binary file or a script?
Are the files owned by user linux-wcz5, why not user glassfish (which I’m guessing is a bin/false user since it’s a system service)?
Now it’s working with the user glassfish… thank you very much!