Getting tomcat the user/group to start did not turn out too hard. changed permissions of everything under apache to tomcat:tomcat then changed all permissions of all things under webapps to me (ray:staff) make the S95tomcat script (start/stop/restart SYSV style) "su tomcat start/stop command"
So tested and worked fine (well I had to fix some directory permissions in one of the apps - tomcat coucl not read, but that was not hard to find and fix. Wrote a tomcat.start systemd file: /local/bin/tomcat.service ------ [Unit] Description=The Jakarta Apache/Tomcat Server After=httpd.target [Service] Type=forking ExecStart=/local/bin/S95tomcat start ExecReload=/local/bin/S95tomcat restart ExecStop=/local/bin/S95tomcat stop [Install] WantedBy=multi-user.target ------ then linked and started systemctl link /local/bin/tomcat.servic systemctl start tomcat WORKS fine - so does restart and stop BUT UNLIKE HTTPD AND NFS, THIS SERVICE DOES NOT COME UP AT BOOT I MUST MANUALLY START IT: sudo systemctl start tomcat I put some logging and see that when the system shutsdown the tomcat:stop script is run but it does not start it. Anyway, this is equivalent to my original rc.local invokation of S95tomcat start not working in the 32 bit world, but now it is in the 64 bit world too. Glad that this is no longer running root, but the systemd problem is not one for this group - so I will ask somewhere else. S95tomcat basically invokes the catalina startup and shutdown scripts with a lot of local cleaning and some other required processes coming up and down as needed. Posting the tomcat.service script for those interested. On Sunday, December 15, 2013 5:55 PM, Ray Holme <rayho...@yahoo.com> wrote: OK, the init.d script was probably very old and it looks like I need to learn systemd control. Did not check apache/logs as there was no sign the script ran, thanks will look there too. yes built and installed mod_jk - the app works fine when I do get it going, yes running SELinux so - time to dig into systemd scripts (after working with Unix BSD and Sys5 for years, I guess I am too used to doing things the old way. argh!!! >My approach would be the following: >1. Create an unprivileged user to run Tomcat >2. Install Tomcat from tomcat.apache.org for this user >3. Create a systemv init script - use tomcat-systemv contents as a guide >4. Wrap the init script in a service file. >5. Use systemctl enable or disable as other systemd services >The init script for Tomcat is pretty ugly - mine's around 575 lines for Tomcat 6 or 7 and CentOS 6.5. The scripts are pretty defensive, which accounts for most of the length. 1-3 are DONE. Yes my script is not quite that long but it is VERY defensive. Time to wrap it in systemd and learn that. Thanks for the pointers. On Sunday, December 15, 2013 3:26 PM, Mark Eggers <its_toas...@yahoo.com> wrote: Some inline and some at the end: Note, this is almost all off-topic, since it concerns system administration and not Tomcat. Note, I'm also comparing this to Fedora 19. Fedora 18 should be EOL in about 5 weeks. On 12/15/2013 7:51 AM, Ray Holme wrote: > I have a rc.local file setup to auto start tomcat and httpd under fedora 18 > boot. > It works fine on my 64 bit system (and a couple others for a friend) > but there MUST BE a sleep before bringing up httpd (for some reason I >forgot). > > start routine in /etc/init.d/rc.local > S95tomcat start > (sleep 10; S96httpd start) & > date > /tmp/last_start > > stop routine > S96httpd stop > S95tomcat stop > date > /tmp/last_stop # not meaningful unless testing rc.local >as boot wipes /tmp > > for the record S96httpd is a link to /etc/init.d/httpd There is no /etc/init.d/httpd script on Fedora 19. Where did you get this script? > and S95tomcat is a script I wrote which does some extra things >besides calling the > official release apache/tomcat up/down scripts > > I also have a portable 32bit fedora 18 box. After installing all the pieces, > I have tomcat/httpd working fine, BUT > they WILL NOT START FROM THE BOOT up like the 64 bit systems do. Don't do this. Fedora 19 uses systemd. The HTTPD package comes with a /usr/lib/systemd/system/httpd.service file that works just fine to control Apache HTTPD. > > I have tried putting more and longer sleeps in place (before tomcat as well > as httpd). All to no avail. > > BUT WHEN I TYPE IN "rc.local start" AS ROOT, ALL COMES UP FINE. > (after logging into the desktop as me and becoming root with "su") in a >command tool > > The only visible difference I have found is in the httpd log > Tomcat's failure is lost or I have not found it yet (yes I looked in > /var/log/messages where I would expect it). Any logging should happen in catalina.out (unless you've done some changes to a stock Tomcat). That location is dependent on where / how you've installed Tomcat. > > --- so here is the /var/log/httpd/error_log after a boot - not sure if the > first two lines are errors, but the third is > (timestamps shortened up for this note) > > [12/15/2013] [core:notice] [pid 1686] SELinux policy enabled; httpd running > as context system_u:system_r:httpd_t:s0 > [12/15/2013] [suexec:notice] [pid 1686] AH01232: suEXEC mechanism enabled > (wrapper: /usr/sbin/suexec) > [12/15/2013] [jk:emerg] [pid 1686] Error in reading worker properties from > '/etc/httpd/conf/workers.properties' > AH00016: Configuration Failed > > > ----- and now for the AFTER I boot and run "rc.local start" as root - note > line 1 has different RUNTIME PERMISSIONS > > [12/15/2013] [core:notice] [pid 2302] SELinux policy enabled; httpd running > as context unconfined_u:system_r:unconfined_t:s0-s0:c0.c1023 > [12/15/2013] [suexec:notice] [pid 2302] AH01232: suEXEC mechanism enabled > (wrapper: /usr/sbin/suexec) > [12/15/2013] [auth_digest:notice] [pid 2303] AH01757: generating secret for > digest authentication ... > [12/15/2013] [lbmethod_heartbeat:notice] [pid 2303] AH02282: No slotmem from > mod_heartmonitor > [12/15/2013] [mpm_prefork:notice] [pid 2303] AH00163: Apache/2.4.6 (Fedora) > mod_jk/1.2.37 configured -- resuming normal operations > [12/15/2013] [core:notice] [pid 2303] AH00094: Command line: '/usr/sbin/httpd' > > Looks at first glance like an SELinux problem. Do you have SELinux enabled? Hopefully you do. If you're using an old / custom script for HTTPD, then it may or may not account for SELinux. Also, how did you install mod_jk, and what is the content of your workers.properties file? BTW, I normally put workers.properties in /etc/httpd/conf.d instead of the main /etc/httpd/conf. > -------------- > So I am guessing here below - anyone please correct. > > Either > a) the permissions are critical between the two runs (if so, how to set >in rc.local) > but ( again ) NO sign of apache tomcat being up either > or > b) something else is still coming up on the system as both tomcat AND >httpd fail originally > but later after I login and become root, the system is stable and up >they come manually > > Workarounds I see for now: > a) use 64bit machines only > or > b) manually start tomcat and httpd every time I boot > or > c) some daemon process is still initializing and I need to ensure that it >is done > > What the HAY???? Wisdom appreciated! > OK, so the following is an outline of how I would run Tomcat as a service on Fedora. Since around Fedora 16, Fedora has been moving to systemd instead of the old System V init scripts. You should no longer use the init method of starting a new service. Instead, use a systemd file to control services. For Tomcat, this means one of two things: 1. Use jsvc and wrap that startup script in a systemd service file 2. Write your own init.d script and wrap it in a systemd service file My approach would be the following: 1. Create an unprivileged user to run Tomcat 2. Install Tomcat from tomcat.apache.org for this user 3. Create a systemv init script - use tomcat-systemv contents as a guide 4. Wrap the init script in a service file. 5. Use systemctl enable or disable as other systemd services The init script for Tomcat is pretty ugly - mine's around 575 lines for Tomcat 6 or 7 and CentOS 6.5. The scripts are pretty defensive, which accounts for most of the length. The systemd service files look pretty easy to write, based on looking at the httpd.service file in /usr/lib/systemd/system. I've not done this, since I only use Fedora systems for development platforms. I start / stop Tomcat manually, normally from within an IDE. All of my other systems are currently CentOS 6.5, and those systems use the System V init scripts. . . . . just my two cents Mark /mde/ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org