Linux shell script for stop/start Tomcat
Dear all,
I have 1 small problem with the script for start/stop tomcat server. --------- Here is my start command ------------ start() { pid=$(tomcat_pid) if [ -n "$pid" ] then echo "Tomcat is already running (pid: $pid)" else echo "Starting tomcat" /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh > /dev/null 2>&1 fi return 0 } -------- Here is how I call the command -------- case $1 in start) start rc_status -v ;; stop) stop rc_status -v ;; restart) stop sleep 5 start ;; ------------------------------- The script above works fine, but: the message "done" is not on the same line with "Starting Tomcat" tomct2v:~ # /etc/init.d/tomcat7 start Starting tomcat done Are there any ways to make "Starting tomcat" and "done" on the same line? |
RTFM
Check the man page for 'echo'.
All you need do is suppress the output of a newline. In current GNU versions of echo, and the bash internals, the -n parameter should help. |
Quote:
It works, thank you so much :) |
All times are GMT -5. The time now is 10:19 PM. |