[vlma-devel] commit: Startup script improvements. (Adrien Grand )
git version control
git at videolan.org
Tue Jul 8 01:04:56 CEST 2008
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Tue Jul 8 01:03:06 2008 +0200| [016c7ceef7aaefb3b0497c11128396b2a4a35a61]
Startup script improvements.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=016c7ceef7aaefb3b0497c11128396b2a4a35a61
---
vlma-distribution/src/bin/vlmad | 38 ++++++++++++++++++++++++++++++++------
1 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/vlma-distribution/src/bin/vlmad b/vlma-distribution/src/bin/vlmad
index 7953667..9e55e23 100644
--- a/vlma-distribution/src/bin/vlmad
+++ b/vlma-distribution/src/bin/vlmad
@@ -1,5 +1,26 @@
#!/bin/sh
+function usage() {
+ echo "Usage: vlmad (start|stop|reload)"
+}
+
+# Parse command line
+COMMAND=$1
+if [ -z "$COMMAND" -o "$COMMAND" == "start" ]
+then
+ echo "[INFO] Starting VLMad."
+elif [ "$COMMAND" == "stop" ]
+then
+ echo "[INFO] Stopping VLMad."
+elif [ "$COMMAND" == "reload" ]
+ then
+ echo "[INFO] Reloading VLMad."
+else
+ echo "[ERROR] Command not found."
+ usage
+ exit 1
+fi
+
# Detect JAVA installation
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]
then
@@ -38,8 +59,13 @@ echo "[INFO] Using VLMA_LOGS: $VLMA_LOGS"
[ -z "$VLMA_WORK" ] && VLMA_WORK="$VLMA_HOME/work"
echo "[INFO] Using VLMA_WORK: $VLMA_WORK"
-# The VLMa daemon jar
-VLMA_JAR=`ls -1 $VLMA_LIBS | grep vlma-daemon`
+# Set classpath
+for jar in $(/bin/ls -1 $VLMA_LIBS)
+do
+ CLASSPATH="$CLASSPATH:$VLMA_LIBS/$jar"
+done
+# If classpath was not defined earlier
+CLASSPATH=$(echo $CLASSPATH | /bin/sed -e "s/^://")
# Set VLMA_OPTS
VLMA_OPTS="$VLMA_OPTS\
@@ -48,10 +74,10 @@ VLMA_OPTS="$VLMA_OPTS\
-Dvlma.data=$VLMA_DATA\
-Dvlma.logs=$VLMA_LOGS\
-Dvlma.work=$VLMA_WORK\
- -Dlog4j.configuration=file:$VLMA_CONF/logging.properties"
+ -Dlog4j.configuration=file:$VLMA_CONF/logging.properties\
+ -classpath $CLASSPATH"
# Run VLMad
-OPTS="$JAVA_OPTS $VLMA_OPTS -jar $VLMA_LIBS/$VLMA_JAR"
-echo "[INFO] Launching $JAVA $OPTS"
-exec "$JAVA" $OPTS
+OPTS="$VLMA_OPTS $JAVA_OPTS org.videolan.vlma.daemon.VLMad $COMMAND"
+exec nohup $JAVA $OPTS < /dev/null > /dev/null 2>&1 &
More information about the vlma-devel
mailing list