Discussion Locked

wrapper scripts

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i want to write a wrapper script for installation
of a application which starts the webserver,and
other executable scripts when the server is turned on?

Urgent Please reply as quickly as possible

6 replies

by alveden

Could you describe what you are trying to achive and expand on the functions of those script.

Please comment

by alveden

Assuming that the other executable are only require to run only once during startup.
Question
1. Which servlet engine are you using, and are you using apache?
2. Which flavour of unix are you using?

You can try this script, place it in your rc directory. A modification of apache startup script for linux. See whether that help.

#!/bin/bash
#
# Startup script for the Apache Web Server

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=/usr/sbin/httpd
prog=httpd
RETVAL=0

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
daemon $httpd $OPTIONS
RETVAL=$?
/PATH/TO/SCRIPT/FILENAME1
/PATH/TO/SCRIPT/FILENAME1
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
pid1=`ps auxw | grep "/PATH/TO/SCRIPT/FILENAME1" | grep -v 'ps auxw' | awk {'print $2'} pid2=`ps auxw | grep "/PATH/TO/SCRIPT/FILENAME1" | grep -v 'ps auxw' | awk {'print $2'}
kill $pid1 $pid2
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $prog {start|stop|restart}"
exit 1
esac

exit $RETVAL

by alveden

Opps, should be FILENAME1 FILENAME2,

Check whether if, that works to your requirement and we will proceed from there

by sankar_2209

Actually I'm working on a webbased application using servlets C program to authenticate to unix,
sybase as the database.I want to write a script
to start the server,and other executables.

This discussion is closed to new replies.