Lazy EBNF and an improved startscript
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:42:17 +0100
changeset 27 4a2f7a1492ab
parent 26 767f79e69de1
child 28 ef929533d040
Lazy EBNF and an improved startscript committer: Markus Bröker <mbroeker@largo.homelinux.org>
scripts/runbot
src/dbtool.c
--- a/scripts/runbot
+++ b/scripts/runbot
@@ -10,22 +10,25 @@
 # Description:       IRC BOT mcbot
 ### END INIT INFO
 
+RUNAS="nobody"
 BINARY="mcbot"
 DIRECTORY="/usr/sbin/"
 LANGUAGE="de_DE.UTF-8"
+PARAMETER=""
+LOGFILE="/var/lib/nobody/mcbot-`date \"+%d-%m-%y\"`.log"
 
 [[ ! -x "${DIRECTORY}/${BINARY}" ]] && exit 0
 
 start() {
-	echo -n "Starting ${BINARY}"
-	su - nobody -c "LANG=$LANGUAGE ${DIRECTORY}/${BINARY} &>/var/lib/nobody/mcbot-`date "+%d-%m-%y"`.log &"
+	echo -n " * Starting ${BINARY}"
+	su - ${RUNAS} -c "LANG=$LANGUAGE ${DIRECTORY}/${BINARY} ${PARAMETER} &> ${LOGFILE} &"
 	if [ "$?" == 0 ]; then
 		echo " [started]"
 	fi
 }
 
 stop() {
-	echo -n "Stopping ${BINARY}"
+	echo -n " * Stopping ${BINARY}"
 	pid=`pidof ${BINARY}`
 	if [ "$pid" != "" ]; then
 		kill -TERM `pidof ${BINARY}`
--- a/src/dbtool.c
+++ b/src/dbtool.c
@@ -16,10 +16,9 @@
 
 void help (char *prgname)
 {
-    printf ("Usage: %s [[-a|-r] -k <key> -v <value>]\n", prgname);
-    printf ("       %s [-d <key>]\n", prgname);
-    printf ("       %s [-f <file>]\n", prgname);
-    printf ("       %s [-s <key>]\n", prgname);
+    printf ("Usage: %s {-a|-r} -k <key> -v <value>] [-f <file>]\n", prgname);
+    printf ("       %s {-s|-d} <key> [-f <file>]\n", prgname);
+    printf ("       %s {-l|-V} [-f <file>]\n", prgname);
     printf ("       %s [-h|-?]\n\n", prgname);
     printf ("Administration tool for adding/replacing, deleting, ... of DataBase Entries.\n\n");
     printf ("Options:\n");