FS#30356 - [tomcat7] Systemd Service

Attached to Project: Arch Linux
Opened by Webhostbudd (Webhostbudd) - Tuesday, 19 June 2012, 12:28 GMT
Last edited by Guillaume ALAUX (galaux) - Tuesday, 21 August 2012, 17:52 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Guillaume ALAUX (galaux)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The current tomcat packages lack systemd startup scripts, making it a little more difficult to run the tomcat service on systemd init only systems. I propose adding a systemd service file for the daemon.
This task depends upon

Closed by  Guillaume ALAUX (galaux)
Tuesday, 21 August 2012, 17:52 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in 7.0.29-1
Comment by Dave Reisner (falconindy) - Tuesday, 19 June 2012, 12:54 GMT
Perhaps you could propose an actual service as well. You're well suited for it, since you actually use it.
Comment by Webhostbudd (Webhostbudd) - Wednesday, 20 June 2012, 14:20 GMT
I was actually working on it when I first posted the ticket, but I couldn't seem to get the tomcat service to start with the commands I was running.

Oddly the commands work fine in a regular shell or in a shell script, but when run through systemd tomcat dies with a string out of bounds error. I'm not sure what the root cause of the error is at this point.
Comment by Webhostbudd (Webhostbudd) - Wednesday, 20 June 2012, 20:11 GMT
Well, it looks like we can just reference the rc.d. That said if the person does not have sysvinit scripts installed on their machine they will run into some log messages about missing file references. Since the add_daemon, get_busy, and stat_* functions don't do anything useful in a systemd environment, the messages are really of no harm or concern. It would be better to have a separate file which runs the same commands used in the rc.d file and also includes the conf.d environment file. Aside from that, here is my working version of the tomcat service and socket.
Comment by Dave Reisner (falconindy) - Wednesday, 20 June 2012, 20:13 GMT
Socket units mean that the service is socket activated, or instanced (via inetd). This isn't the case here. There's absolutely nothing gained by wrapping the /etc/rc.d script, either.
Comment by Guillaume ALAUX (galaux) - Sunday, 01 July 2012, 09:41 GMT
I'm totally ignorant when it comes to systemd but as I thought about giving it a try I will consider this.
Comment by Guillaume ALAUX (galaux) - Sunday, 19 August 2012, 14:22 GMT
Taken care of in 7.0.29-1.
@Webhostbudd: Feedback would be appreciated :)
Comment by Ilmari Vacklin (wolverian) - Tuesday, 21 August 2012, 09:50 GMT
Thanks for this update. I now get this error when trying to launch Tomcat:

$ sudo systemctl start tomcat7
Failed to issue method call: Unit tomcat7.service failed to load: No such file or directory. See system logs and 'systemctl status tomcat7.service' for details.

$ sudo systemctl status tomcat7
tomcat7.service
Loaded: error (Reason: No such file or directory)
Active: failed (Result: exit-code) since Mon, 20 Aug 2012 12:18:39 +0300; 24h ago
Main PID: 2019 (code=exited, status=143)

journalctl and /var/log/tomcat7 do not contain anything relevant. I'm new to systemd too, so I don't know how to debug this further.
Comment by Guillaume ALAUX (galaux) - Tuesday, 21 August 2012, 09:58 GMT
> Unit tomcat7.service failed to load: No such file or directory
Could you please check /lib/systemd/system/tomcat7.service is present

I have always used the '.service' post part for my tests:
# systemctl start tomcat7.service

Could you please try this (I know the error message states 'tomcat7.service' but let's try).
Comment by Ilmari Vacklin (wolverian) - Tuesday, 21 August 2012, 10:00 GMT
$ ls -l /lib/systemd/system/tomcat7.service
-rw-r--r-- 1 root root 1049 Aug 19 17:08 /lib/systemd/system/tomcat7.service

$ sudo systemctl start tomcat7.service
Failed to issue method call: Unit tomcat7.service failed to load: No such file or directory. See system logs and 'systemctl status tomcat7.service' for details.

$ sudo systemctl status tomcat7.service
tomcat7.service
Loaded: error (Reason: No such file or directory)
Active: failed (Result: exit-code) since Mon, 20 Aug 2012 12:18:39 +0300; 24h ago
Main PID: 2019 (code=exited, status=143)
Comment by Dave Reisner (falconindy) - Tuesday, 21 August 2012, 10:09 GMT
Run one of the following:
# systemctl daemon-reload
# kill -1 1

Until then, systemd will not read newly installed (or updated) unit files.
Comment by Ilmari Vacklin (wolverian) - Tuesday, 21 August 2012, 10:32 GMT
Thanks, that seems to do the trick. Sorry for the noise on this report.

The kill call was not necessary.
Comment by Guillaume ALAUX (galaux) - Tuesday, 21 August 2012, 17:52 GMT
Thanks for this Dave.

Loading...