/etc/rc.d/rc0.d
/etc/rc.d/rc1.d
/etc/rc.d/rc3.d
/etc/rc.d/rc5.d
分别对应着0,1,3,5这几个运行级别,关于运行级别的官方解释如下(以红帽为例):
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
在0,1,3,5这几个文件夹下面会找到“S99arcgisserver”文件,可见ArcGIS Server在服务器正常运行时都会随系统自动启动。
为了更详细的了解启动过程,我们来看一下文件内容:
#!/bin/sh # #chkconfig 35 99 01 ### BEGIN INIT INFO # Provides: arcgisserver # Required-Start: $ALL # Default-Start: 3 5 6 # Default-Stop: 0 1 2 4 # Description: ArcGIS Server Services # Short-Description: ArcGIS Server ### END INIT INFO installDir=/opt/arcgis/server10.0; export installDir . ${installDir}/servercore/.Server/init_server.sh LOG_FILE=${installDir}/servercore/.Server/AGSServer.log; export LOG_FILE if [ -f ${installDir}/.Setup/agsowner ]; then agsowner=`cat ${installDir}/.Setup/agsowner` else echo "ERROR: ArcGIS Server Setup has not executed properly. Please re-install and try again" exit 0 fi tmp_account=`id | cut -f2 -d\( | cut -f1 -d\)` if [ "$tmp_account" != "$agsowner" ]; then same_account="false" else same_account="true" fi rm -rf ${LOG_FILE} if [ "$same_account" = "true" ]; then echo " " >> ${LOG_FILE} echo " " >> ${LOG_FILE} echo "Script invoked on `date`" >> ${LOG_FILE} fi issom=`grep SOM_INSTALLED ${installDir}/.Setup/install.properties | cut -f 2 -d "="` if [ "$issom" = "true" ]; then cmdToRun=${installDir}/servercore/.Server/serverobjectmanager else cmdToRun=${installDir}/servercore/.Server/serverobjectcontainer fi case "$1" in 'start') echo "Starting ArcGIS Server..." if [ "$same_account" != "true" ]; then if [ "$tmp_account" != "root" ]; then echo "Enter password for $agsowner" fi su - $agsowner -c "/bin/sh -c \"${cmdToRun} start\"" else /bin/sh -c "${cmdToRun} start" fi ;; 'stop') echo "Stopping ArcGIS Server..." if [ "$same_account" != "true" ]; then if [ "$tmp_account" != "root" ]; then echo "Enter password for $agsowner" fi su - $agsowner -c "/bin/sh -c \"${cmdToRun} stop\"" else /bin/sh -c "${cmdToRun} stop" fi ;; esac
首先验证是否为ArcGIS Server所有者用户,如果是以所有者或root用户登录系统,会自动启动ArcGIS Server;如果以其他用户登录系统,会提示要求输入所有者用户的密码。然后根据系统是否安装soc,执行启动。