Resin-startup script httpd. sh Analysis

Source: Internet
Author: User

Resin-startup script httpd. sh Analysis
After analyzing the tomcat startup scripts, we found that catalina. THE sh script has a problem in stopping, but the author has never found that the service cannot be stopped when using resin in the production environment, so let's analyze the resin STARTUP script httpd first. sh.

#! /Bin/sh # httpd. sh can be called like apachectl # httpd. sh -- execs the web server in the foreground # httpd. sh start -- starts the web server in the background # httpd. sh stop -- stops the web server # httpd. sh restart -- restarts the web server # httpd. sh will return a status code if the wrapper detects an error, but # some errors, like bind exceptions or Java errors, are not detected. # Customized arguments, e.g. -resin_home or-java_home or-pid. #-pid -- use a non-default pid file # (useful for multiple servers) #-java_home -- use a non-default Java home #-stdout -- stdout message log #-stderr -- stderr message log #-native -- force native threads #-green -- force green threads # -verbose -- prints Java arguments before starting. #-no-auto-restart -- disable automatic server restart # -- (this only appled to start and restart) # This script can be used as a Linux boot script in init. d. you'll need to # configure JAVA_HOME and RESIN_HOME directly. # chkconfig: 345 86 14 # description: Resin is a servlet web server. # processname: wrapper. pl # To install, you'll need to configure JAVA_HOME and RESIN_HOME and # copy httpd. sh to/etc/rc. d/init. d as resin. then # use "unix #/sbin/chkconfig resin on" ### You can predefine JAVA_HOME and RESIN_HOME # JAVA_HOME =/usr/java # export JAVA_HOME # RESIN_HOME =/usr/ local/resin # export RESIN_HOME # Extra arguments to Java. if you're passing arguments to the JVM, you'll # need to use-Jxxx. for example, args = "-J-ms48m ". you can modify # the pid file with args = "-pid server-a.pid" # args =## class to start # class = com. caucho. server. resin. resin # name of the server # name = httpd # location of perl executable # perl = perl # On Linux, you may want to reduce the stack size per thread to allow # for more threads. the default 8192 k stack per thread gives 255 threads. # Changing it to 2048 k per thread gives 1023 threads # ulimit-s 2048 # trace script and simlinks to find thw wrapper # script = '/bin/ls-l $0 | awk '{print $ NF ;} ''# simply exclude the file name as a link file. If multiple links are used, the actual source path cannot be found. # more robust code can be modeled like tomcat's startup. sh # while [-h "$ PRG"]; do # ls = 'LS-ld "$ PRG" '# link = 'expr "$ ls ":'. *-> \(. * \) $ ''# if expr" $ link ":'/. * '>/dev/null; then # PRG = "$ link" # else # PRG = 'dirname "$ PRG" '/"$ link" # fi # done ########### ######################################## ################# this time, the link path is stripped using a loop, find the real source, the same as the previous code. The while test-h "$ script" # test-h File exists and is a symbolic link (same as-L) do script = '/bin/ls-l $ script | awk' {print $ NF;}' donebin = 'dirname $ script' exec $ perl $ bin/wrapper. pl-chdir-name "$ name"-class "$ class" $ args $ * # pass the parameter to the perl script for execution # exec perl. /wrapper. pl-chdir-name httpd-class com. caucho. server. resin. resin # generally, the following parameter is-server a start | stop.
Summary

As you can see, the resin httpd. sh script is simpler than tomcat's startup. sh and shutdown. sh. This script does three things:

Define some variables

Exclude link find Source Path

Pass all the parameters to the perl script wrapper. pl. All the subsequent tasks will be handed over to it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.