Domino control center

[email protected] Fri, 15 Apr 2005 11:59:30 +0200
Newsgroups gmane.linux.suse.domino
Message-ID <OF4C60DECA.9BEBA364-ONC1256FE4.0034CA44-C1256FE4.0036DD04@unog.un.org>



Hi there,

I created a script to do some Domino related task without typing long
command.
(see below print screen)
This script use the config file /etc/sysconfig/domino1 (domino_runtime
package)

If someone wants to use it,  improve it or got ideas for enhancement...

Regards,
Jerome

----------------------------------------------------------------------------------------------
 Server : DominoSan1     (Process:   1203  http:     63  router:      4)

 Choose option , q to quit

 (1) - DominoSan1 console
 (2) - Send command to DominoSan1
 (3) - Start DominoSan1
 (4) - Stop DominoSan1
 (5) - kill server DominoSan1
 (q) - Quit

      Choice:
----------------------------------------------------------------------------------------------

Note:
the script read the variable OUTPUT_LOG and INPUT_FILE in
/etc/sysconfig/domino1.
Originally (in domino runtime package) this variables were in /etc/init.d
/domino1.
Move them to the etc/sysconfig/domino1 file in order to run the script.

(See attached file: dom1.txt)

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
dom1.txt (application/octet-stream, 2.5 KB)
#!/bin/bash
# jli - 15 avril 2005

# read config in /etc/sysconfig/domino1
test -r /etc/sysconfig/domino1 && . /etc/sysconfig/domino1 || exit 6

PSERVER=0
PHTTP=0
PROUTER=0

aff1() {
  Server_Process
  clear
  echo -e
  echo -e "\n Server : $NOTES_SERVER     (Process:$PSERVER  http:$PHTTP  router:$PROUTER)"
  echo -e "\n Choose option , q to quit"
  echo -e "\n (1) - $NOTES_SERVER console\c"
  echo -e "\n (2) - Send command to $NOTES_SERVER\c"
  echo -e "\n (3) - Start $NOTES_SERVER\c"
  echo -e "\n (4) - Stop $NOTES_SERVER\c"
  echo -e "\n (5) - kill server $NOTES_SERVER\c"
  echo -e "\n (q) - Quit"
  echo -e
  echo -e "      Choice:\c"
}

Server_Process() {
  PSERVER=$(ps auxww | grep $NOTES_USER | wc -l) 
  PHTTP=$(ps auxww | grep $NOTES_USER | grep http | wc -l)
  PROUTER=$(ps auxww | grep $NOTES_USER | grep router | wc -l) 
}

Server_Kill() {
  clear
  echo -e
  echo -e "\n Kill server $NOTES_SERVER ? "
  echo -e
  echo -e "      Choice(y/n):\c"
  read REPLY
  TOKILL=$(ps auxww | grep $NOTES_USER  | grep -v grep | awk '{print $2}' | wc -l)
  ps auxww | grep $NOTES_USER | grep -v grep | awk '{print $2}' | xargs kill -9
  echo -e
  read -s -n1 -p "$TOKILL process killed...Hit a key " keypress
}

Server_Start() {
  clear
  echo -e
  echo -e "\n Start server $NOTES_SERVER ? "
  echo -e
  echo -e "      Choice(y/n):\c"
  read REPLY
  if [ "$REPLY" == "y" ]; then
     /etc/init.d/domino1 start
     exit
  fi
}

Server_Stop() {
  clear
  echo -e
  echo -e "\n Stop server $NOTES_SERVER ? "
  echo -e
  echo -e "      Choice(y/n):\c"
  read REPLY
  if [ "$REPLY" == "y" ]; then
     /etc/init.d/domino1 stop
     exit
  fi
}

Server_Console() {
	clear
	echo -e "Domino $NOTES_SERVER live console - press CTRL+C to quit"
	echo -e
	tail -f --lines=17 $OUTPUT_LOG
}

Server_Command() {
  clear
  echo -e
  echo -e "Domino $NOTES_SERVER"
  echo -e "\n Enter command , q to quit : \c"
  read COMMAND
  if [ "$COMMAND" == "q" ]; then
    echo -e
  else
    echo $COMMAND >> $INPUT_FILE
    echo -e
    echo -e " command sent...press return\c"
    read COMMAND
  fi
}

while true; do
 aff1
 read REPLY
 if [ "$REPLY" == "q" ]; then
    echo -e
    exit
  fi
  if [ "$REPLY" == "1" ]; then
    Server_Console
  fi
  if [ "$REPLY" == "2" ]; then
    Server_Command
  fi
  if [ "$REPLY" == "3" ]; then
    Server_Start
  fi
  if [ "$REPLY" == "4" ]; then
    Server_Stop
  fi
  if [ "$REPLY" == "5" ]; then
    Server_Kill
  fi

done