最近裝一部Lotus Domino for Linux , 用Lotus Domino for Linux 有一個問題, 就係要每次著機自動啟動(auto start) Lotus Domino ....

Lotus Domino 的installation file 本身無跟這個script , IBM 其實都有一個示範, 不過都是很多年前 (Lotus Domino 6.0) 的事了, 要做幾大修改 ...

其實有網友修改了這個script , 可以相對簡單設定, 又是符合Lotus Domino 抄抄貼貼的管理風格

 



 

1. 用vi 製作 /etc/init.d/domino

一式一樣即可, 不用修改 , 或者可以下載使用 ....

#!/bin/sh
#
# domino Start/stop the Lotus Domino server
#
# chkconfig: 345 01 95
# description: This script is used to start and stop the domino \
# server as a background process. It will send \
# the serverID password from a file to the server.\
# Communication with the server has to be done through \
# console, Notes Administrator or webadmin.\
#
# Usage: /etc/rc.d/init.d/domino start|stop|restart|condrestart
#
# process name: server, ...
#
# Version 1.1, by LB, 2205-01-07

# Change the USER, GROUP, DATA_DIR and BIN_DIR for your server
DOMINO_USER="notes"
DOMINO_GROUP="notes"
DOMINO_DATA_DIR="/local/notesdata"
DOMINO_BIN_DIR="/opt/ibm/lotus/bin"
LOCKFILE="/var/lock/subsys/domino"

export ODBCINI="/etc/odbc.ini"

# We need a file to put the serverID password in.
# Make sure the owner is the Domino owner and the file
# permissions are set to 400

SERVER_PASSWD_FILE="/local/notesdata/.domino.pwd"

# See if the user that runs this script is root

if [ `id -u` != 0 ]; then
echo "This script must be run by root only"
exit 1
fi

start() {
# First, check if the password file exists,
# and if not, exit with an errorcode
if [ ! -f $SERVER_PASSWD_FILE ] ; then
echo "Error: no password file."
exit 1
fi

# Set permission to 400 (read-only-owner)
# and ownership to $DOMINO_USER. These next lines are
# not necessary if the ownership was set correctly the first time.

chmod 400 $SERVER_PASSWD_FILE
chown $DOMINO_USER.$DOMINO_GROUP $SERVER_PASSWD_FILE

# Check we're not already running

if [ -f $LOCKFILE ] ; then
echo "Domino server apparently already running."
exit 1
fi

# Two ways to run the server (comment one of them out)
# 1. With the output of the console redirected to /var/log/domino.log
# Be sure to change the logrotate daemon.
# 2. With the output of the console redirected to /dev/null

echo -n "Starting domino server..."

# Version with logfile
su - ${DOMINO_USER} -c "cd ${DOMINO_DATA_DIR};\
cat ${SERVER_PASSWD_FILE} | ${DOMINO_BIN_DIR}/server" \
>> /var/log/domino 2>&1 &
RETVAL=$?
if [ "$RETVAL" = "0" ] ; then
touch $LOCKFILE > /dev/null 2>&1
fi
# Version without logfile
# su - ${DOMINO_USER} -c "cd ${DOMINO_DATA_DIR};\
# cat ${SERVER_PASSWD_FILE} |\
# ${DOMINO_BIN_DIR}/server" > /dev/null 2>&1 &

echo "done."
}

stop() {
echo -n "Stopping Domino server. "
su - ${DOMINO_USER} -c "cd ${DOMINO_DATA_DIR}; ${DOMINO_BIN_DIR}/server -q"
RETVAL=$?
# RETVAL is 38 on normal shutdown - what does *that* mean?
# Users should test this on their own systems . . .
if [ $RETVAL -lt 50 ] ; then
rm $LOCKFILE
fi
}

restart() {
stop
start
}

# See how we were called.

case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
[ -f $LOCKFILE ] && restart
;;
*)
echo "Usage: domino {start|stop|restart|condrestart}"
exit 1
;;

esac

# End of the domino script
exit 0

 

再建立密碼檔案 , 並用chkconfig 啟動服務

#   touch  /local/notesdata/.domino.pwd
# chkconfig  domino  on
# service  domino  start

Reminder : 一般來講, Server ID 沒有密碼的 .... 所以一個空白的檔案, 可以的了

由於此script 會產生system log, 放在 /var/log/domino , 所以可以設定logroutete , 定期清理Log

# vi  /etc/logrotate.d/domino

內容: (以下設定保留7日Console 的記錄)

/var/log/domino {
rotate 7
daily
copytruncate
compress
errors [email]This email address is being protected from spambots. You need JavaScript enabled to view it.[/email]
}


Ref : http://www.lesbell.com.au/Home.nsf/b8ec57204f60dfcb4a2568c60014ed0f/ac3934bc047107bcca2569f1000f4f78?OpenDocument

Add comment


Security code
Refresh