Domino 9 und frühere Versionen > Administration & Userprobleme
domino unter debian
Stefan Bechtold:
Hi,
ich hab hier nun ein startup script, aber leider gibt es mir beim öffnen folgende Fehler:
inet01:/etc/init.d# ./domino
: command not found
: command not found
: command not found
./domino: /etc/rc.d/init.d/functions: line 53: syntax error near unexpected toke ' `{
´domino: /etc/rc.d/init.d/functions: line 53: 'daemon() {
Das Script und die Functions kommen in den folgenden Beiträgen...
Kann jemd das entschlüsseln und die Fehler beheben? :o)
Grüße Stefan
Stefan Bechtold:
--- Zitat ---#!/bin/sh
# chkconfig: 2345 99 00
# Startup script for Domino R5
#
# description: This script starts the Domino server in a screen session \
# And ensures a proper shutdown before the system goes down.
#
# Author: Oystein Baarnes <dominolinux@baarnes.com>
DESC="Domino R5"
SrvAcc="notes"
DominoDir="/var/local/notesdata"
DominoSrv="/usr/local/lotus/bin/server"
TimeOutKill=300
TasksToKill="server replica router update stats logasio adminp sched calconn event pop3 imap maps ldap http smtp mtc amgr"
tok=0
. /etc/rc.d/init.d/functions
getpid() {
pid=`/sbin/pidof -s server`
}
getpid
case "$1" in
start)
if [ "$pid" = "" ]; then
echo -n "Starting $DESC: "
su - $SrvAcc -c "cd $DominoDir && screen -m -d -S Domino $DominoSrv"
sleep 3
getpid
if [ "$pid" != "" ]; then
success
touch /var/lock/subsys/domino
else
failure
fi
echo
fi
;;
stop)
TimeOutKill=$[TimeOutKill/2]
echo -n "Shutting down $DESC: "
if [ "$pid" != "" ]; then
cd $DominoDir
/opt/lotus/notes/latest/linux/server -quit > /dev/null &
# Let's wait for the Domino to terminate
while [ "$pid" != "" ] && [ "$tok" != "$TimeOutKill" ] ; do
tok=$[tok+1]
sleep 2
getpid
done
if [ "$tok" != "$TimeOutKill" ] ; then
success
else
failure
$0 kill
fi
else
failure
fi
echo
;;
kill)
echo -n "Killing $DESC: "
kill -9 `/sbin/pidof -s $TasksToKill` > /dev/null
sleep 1
kill -9 `/sbin/pidof -s $TasksToKill` > /dev/null
sleep 1
tmp=`/sbin/pidof -s $TasksToKill`
if [ "$tmp" = "" ]; then
success
rm -f /var/lock/subsys/domino
else
failure
fi
echo
;;
status)
status server
;;
restart)
if [ "$pid" != "" ]; then
$0 stop
fi
$0 start
;;
*)
echo
echo "Usage: domino {start|stop|kill|restart|status}"
echo
exit 1
;;
esac
--- Ende Zitat ---
Stefan Bechtold:
--- Zitat ---#!/bin/sh
#
# functions This file contains functions to be used by most or all
# shell scripts in the /etc/init.d directory.
#
# Version: @(#) /etc/init.d/functions 1.01 26-Oct-1993
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Hacked by: Greg Galloway and Marc Ewing
#
# First set up a default search path.
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
# Get a sane screen width
[ -z "$COLUMNS" ] && COLUMNS=80
# Read in our configuration
if [ -z "$BOOTUP" ]; then
if [ -f /etc/sysconfig/init ]; then
. /etc/sysconfig/init
else
# This all seem confusing? Look in /etc/sysconfig/init,
# or in /usr/doc/initscripts-*/sysconfig.txt
BOOTUP=color
RES_COL=60
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
LOGLEVEL=1
fi
if [ -x /sbin/consoletype ]; then
if [ "`consoletype`" = "serial" ]; then
BOOTUP=serial
MOVE_TO_COL=
SETCOLOR_SUCCESS=
SETCOLOR_FAILURE=
SETCOLOR_WARNING=
SETCOLOR_NORMAL=
fi
fi
fi
if [ "$BOOTUP" != "verbose" ]; then
INITLOG_ARGS="-q"
else
INITLOG_ARGS=
fi
# A function to start a program.
daemon() {
# Test syntax.
gotbase=
case $1 in
'') echo '$0: Usage: daemon [+/-nicelevel] {program}'
return 1;;
--check)
shift
base=$1
gotbase="yes"
shift
nicelevel=0
;;
-*|+*) nicelevel=$1
shift;;
*) nicelevel=0;;
esac
# Save basename.
[ -z $gotbase ] && base=`basename $1`
# See if it's already running.
pid=`pidofproc $base`
[ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && return
# make sure it doesn't core dump anywhere; while this could mask
# problems with the daemon, it also closes some security problems
ulimit -c 0
# Echo daemon
[ "$BOOTUP" = "verbose" ] && echo -n " $base"
# And start it up.
nice -n $nicelevel initlog $INITLOG_ARGS -c "$*" && success "$base startup" || failure "$base startup"
}
# A function to stop a program.
killproc() {
RC=0
# Test syntax.
if [ $# = 0 ]; then
echo "Usage: killproc {program} [signal]"
return 1
fi
notset=0
# check for second arg to be kill level
if [ "$2" != "" ] ; then
killlevel=$2
else
notset=1
killlevel="-9"
fi
# Save basename.
base=`basename $1`
# Find pid.
pid=`pidofproc $base`
# Kill it.
if [ "$pid" != "" ] ; then
[ $BOOTUP = "verbose" ] && echo -n "$base "
if [ "$notset" = "1" ] ; then
if ps h $pid>/dev/null 2>&1; then
# TERM first, then KILL if not dead
kill -TERM $pid
usleep 100000
if ps h $pid >/dev/null 2>&1 ; then
sleep 1
if ps h $pid >/dev/null 2>&1 ; then
sleep 3
if ps h $pid >/dev/null 2>&1 ; then
kill -KILL $pid
fi
fi
fi
fi
ps h $pid >/dev/null 2>&1
RC=$?
[ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
RC=$((! $RC))
# use specified level only
else
if ps h $pid >/dev/null 2>&1; then
kill $killlevel $pid
RC=$?
[ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
fi
fi
else
failure "$base shutdown"
fi
# Remove pid file if any.
if [ "$notset" = "1" ]; then
rm -f /var/run/$base.pid
fi
return $RC
}
# A function to find the pid of a program.
pidofproc() {
# Test syntax.
if [ $# = 0 ] ; then
echo "Usage: pidofproc {program}"
return 1
fi
# First try "/var/run/*.pid" files
if [ -f /var/run/$1.pid ] ; then
pid=`head -1 /var/run/$1.pid`
if [ "$pid" != "" ] ; then
echo $pid
return 0
fi
fi
# Next try "pidof"
pid=`pidof $1`
if [ "$pid" != "" ] ; then
echo $pid
return 0
fi
# Finally try to extract it from ps
ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 }
{ if ((prog == $5) || (("(" prog ")") == $5) ||
(("[" prog "]") == $5) ||
((prog ":") == $5)) { print $1 ; exit 0 } }' $1
}
status() {
# Test syntax.
if [ $# = 0 ] ; then
echo "Usage: status {program}"
return 1
fi
# First try "pidof"
pid=`pidof $1`
if [ "$pid" != "" ] ; then
echo "$1 (pid $pid) is running..."
return 0
else
pid=`ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 }
{ if ((prog == $5) || (("(" prog ")") == $5) ||
(("[" prog "]") == $5) ||
((prog ":") == $5)) { print $1 ; exit 0 } }' $1`
if [ "$pid" != "" ] ; then
echo "$1 (pid $pid) is running..."
return 0
fi
fi
# Next try "/var/run/*.pid" files
if [ -f /var/run/$1.pid ] ; then
pid=`head -1 /var/run/$1.pid`
if [ "$pid" != "" ] ; then
echo "$1 dead but pid file exists"
return 1
fi
fi
# See if /var/lock/subsys/$1 exists
if [ -f /var/lock/subsys/$1 ]; then
echo "$1 dead but subsys locked"
return 2
fi
echo "$1 is stopped"
return 3
}
echo_success() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "[ "
[ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
echo -n "OK"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n " ]"
echo -ne "\r"
return 0
}
echo_failure() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
echo -n "FAILED"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
echo_passed() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo -n "PASSED"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
# Log that something succeeded
success() {
if [ -z "$IN_INITLOG" ]; then
initlog $INITLOG_ARGS -n $0 -s "$1" -e 1
else
# silly hack to avoid EPIPE killing rc.sysinit
trap "" SIGPIPE
echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21
trap - SIGPIPE
fi
[ "$BOOTUP" != "verbose" ] && echo_success
return 0
}
# Log that something failed
failure() {
rc=$?
if [ -z "$IN_INITLOG" ]; then
initlog $INITLOG_ARGS -n $0 -s "$1" -e 2
else
trap "" SIGPIPE
echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 2" >&21
trap - SIGPIPE
fi
[ "$BOOTUP" != "verbose" ] && echo_failure
return $rc
}
# Log that something passed, but may have had errors. Useful for fsck
passed() {
rc=$?
if [ -z "$IN_INITLOG" ]; then
initlog $INITLOG_ARGS -n $0 -s "$1" -e 1
else
trap "" SIGPIPE
echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21
trap - SIGPIPE
fi
[ "$BOOTUP" != "verbose" ] && echo_passed
return $rc
}
# Run some action. Log its output.
action() {
STRING=$1
echo -n "$STRING "
shift
initlog $INITLOG_ARGS -c "$*" && success "$STRING" || failure "$STRING"
rc=$?
echo
return $rc
}
# Confirm whether we really want to run this service
confirm() {
echo -n "Start service $1 (Y)es/(N)o/(C)ontinue? [Y] "
read answer
case $answer in
y|Y|"")
return 0
;;
c|C)
return 2
;;
n|N)
return 1
;;
*)
confirm $1
return $?
;;
esac
}
--- Ende Zitat ---
heini_schwammerl:
Lieber Stefan,
weil es so schön aussah hab ich das mal ausprobiert. Verschiedene Befehle mußte ich von meiner parallel installierten Mandrake Installation klauen, pidof liegt bei Debian in bin und nicht in sbin (das sollte mit einem Symlink funktionieren).
Die Syntaxfehler bekomme ich nicht, command not found deutet auf fehlende Pakete hin.
z. B. apt-get install screen
würde mir einfallen da dies wohl im Standard nicht dabei ist
consoletype gibts bei Debian anscheinend nicht (hab ich klauen müssen)
In rc.d hab ich noch Links gelegt (bei mir stehen domino und functions unter /etc/init.d
Der Server fährt nun hoch und runter, so schlimm kanns nicht sein. Allerdings hab ich zu Hause Debian Unstable.
Gruß
Heini
Stefan Bechtold:
Hi Heini :)
also, dass diese Zeilen mit ": command not found" auf fehlende Pakete zurückzuführen sein könnten, dachte ich mir auch, aber dann sollte doch vor dem : (Doppelpunkt) eigentlich auch ein Befehl stehen, der nicht gefunden wurde, oder?
Ich habe den Code dann nochmal abgetippt (Zeile für Zeile mit der Hand) und siehe da, es lief ohne "command not found" scheinbar waren da "leere zeichen" drin, die nicht angezeigt wurden und deshalb irgendwie fehler verursachten...
naja. Hab jetzt nur noch ein Problem, nämlich wenn ich ./domino start/stop/status/etc. ausführe kommt dieser Fehler hier:
--- Code: ---inet01:/home/stefan# ./domino status
'/domino: ./functions: line 56: syntax error near unexpected token `in
'/domino: ./functions: line 56: ` case $1 in
./domino: status: command not found
--- Ende Code ---
Wenn ich ehrlich bin, denke ich dass das auch wieder so ein schmarn mit einem Whitespace ist, nur ich wollte die functions nicht auch noch komplett abtippen *g*
Hast du irgendetwas besonderes gemacht, oder einfach via Putty (oder ähnliches) eingefügt - aus der Zwischenablage?? - Würde mich mal interessieren.
Die Verzeichnisse habe ich auch geändert, dh. mein Domino startet auch, aber der Fehler über die falsche functions kommt eben trotzdem :(
Danke nochmal für die interessante Antwort.
Besonders das mit der rc.d hat mir geholfen :)
Ich weiß zwar was ich tun muss (in den Dateien) aber die Namen der Dateien hab ich noch überhaupt net drauf was Linux Debian angeht :( - kommt aber noch :)
Danke & Gruß
Stefan
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln