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

Reply via email to