05-13-2006
shell script as a daemon
hi,
can i run a shell script as a daemon ?
the shell script looks like this :
Quote:
#!/bin/sh
BATDIR='/'
export JAVA_HOME='/usr/java/jdk1.5.0_06/bin/java'
export MESSAGE_SENDER_HOME='/home/mas50o21/MessageReader/'
export LIB='/lib/'
export COMMONS='/commons/'
export JBOSS_HOME='/home/jboss/jboss-4.0.3SP1/'
export CLASSPATH=$CLASSPATH:${JBOSS_HOME}client/jboss-common-client.jar: \
${JBOSS_HOME}client/namespace.jar:${JBOSS_HOME}client/jboss-system-client.jar: \
${JBOSS_HOME}client/getopt.jar:${JBOSS_HOME}client/log4j.jar: \
${JBOSS_HOME}client/activation.jar:${JBOSS_HOME}client/jboss-jaxrpc.jar: \
${JBOSS_HOME}client/mail.jar:${JBOSS_HOME}client/jboss-saaj.jar: \
${JBOSS_HOME}client/jboss-j2ee.jar:${JBOSS_HOME}client/jboss-transaction-client.jar: \
${JBOSS_HOME}client/jmx-invoker-adapator-client.jar:${JBOSS_HOME}client/concurrent.jar: \
${JBOSS_HOME}client/jboss-deployment.jar:${JBOSS_HOME}client/jbossx-client.jar: \
${JBOSS_HOME}client/jbossmq-client.jar: \
${JBOSS_HOME}client/jbosscx-client.jar:${JBOSS_HOME}client/commons-logging.jar: \
${JBOSS_HOME}client/axis-ws4ee.jar:${JBOSS_HOME}client/wsd14j.jar: \
${JBOSS_HOME}client/commons-discovery.jar:${JBOSS_HOME}client/jboss-ws4ee-client.jar: \
${JBOSS_HOME}client/jbossha-client.jar:${JBOSS_HOME}client/scout.jar: \
${JBOSS_HOME}client/jboss-juddiaxis.jar:${JBOSS_HOME}client/jbossjmx-ant.jar: \
${JBOSS_HOME}client/jboss-iiop-client.jar:${JBOSS_HOME}client/avalon-framework.jar: \
${JBOSS_HOME}client/logkit.jar:${JBOSS_HOME}client/jacorb.jar: \
${JBOSS_HOME}client/jboss-jsr77-client.jar:${JBOSS_HOME}client/jbossall-client.jar: \
${JBOSS_HOME}server/mobi/lib/jnpserver.jar:${JBOSS_HOME}server/mobi/lib/activation.jar: \
${JBOSS_HOME}server/mobi/lib/bsh-deployer.jar:${JBOSS_HOME}server/mobi/lib/jboss-transaction.jar: \
${JBOSS_HOME}server/mobi/lib/jbossmq.jar:${JBOSS_HOME}server/mobi/lib/jboss-common-jdbc-wrapper.jar: \
${JBOSS_HOME}server/mobi/lib/javax.servlet.jar:${JBOSS_HOME}server/mobi/lib/mail.jar: \
${JBOSS_HOME}server/mobi/lib/hsqldb-plugin.jar:${JBOSS_HOME}server/mobi/lib/jboss.jar: \
${JBOSS_HOME}server/mobi/lib/jpl-pattern.jar:${JBOSS_HOME}server/mobi/lib/log4j.jar: \
${JBOSS_HOME}server/mobi/lib/hsqldb.jar:${JBOSS_HOME}server/mobi/lib/jboss-jsr77.jar: \
${JBOSS_HOME}server/mobi/lib/jboss-monitoring.jar:${JBOSS_HOME}server/mobi/lib/commons-logging.jar: \
${JBOSS_HOME}server/mobi/lib/properties-plugin.jar:${JBOSS_HOME}server/mobi/lib/jboss-j2ee.jar: \
${JBOSS_HOME}server/mobi/lib/jmx-adaptor-plugin.jar:${JBOSS_HOME}server/mobi/lib/jpl-util.jar: \
${JBOSS_HOME}server/mobi/lib/jboss-jaxrpc.jar:${JBOSS_HOME}server/mobi/lib/mail-plugin.jar: \
${JBOSS_HOME}server/mobi/lib/jboss-jca.jar:${JBOSS_HOME}server/mobi/lib/snmp-support.jar: \
${JBOSS_HOME}server/mobi/lib/bsh-1.3.0.jar:${JBOSS_HOME}server/mobi/lib/jboss-saaj.jar: \
${JBOSS_HOME}server/mobi/lib/commons-httpclient.jar:${JBOSS_HOME}server/mobi/lib/jbosssx.jar: \
${JBOSS_HOME}server/mobi/lib/scheduler-plugin.jar:${JBOSS_HOME}server/mobi/lib/scout.jar: \
${JBOSS_HOME}server/mobi/lib/bindingservice-plugin.jar:${JBOSS_HOME}server/mobi/lib/javax.servlet.jsp.jar: \
${JBOSS_HOME}server/mobi/lib/jboss-management.jar:${JBOSS_HOME}server/mobi/lib/bcel.jar: \
${JBOSS_HOME}server/mobi/lib/scheduler-plugin-example.jar:${JBOSS_HOME}server/mobi/lib/autonumber-plugin.jar: \
${JBOSS_HOME}server/mobi/lib/webcallbackhandler.jar: \
${JBOSS_HOME}server/mobi/lib/ReferenceGeneratorInterfaces.jar:${JBOSS_HOME}server/mobi/lib/jtds-1.1.jar: \
${JBOSS_HOME}server/mobi/lib/ojdbc14.jar:${JBOSS_HOME}server/mobi/lib/SeakeyComponents.jar: \
${JBOSS_HOME}server/mobi/lib/threadpool.jar:${JBOSS_HOME}server/mobi/lib/quartz.jar: \
${JBOSS_HOME}server/mobi/deploy/ejb.jar/SeaKeyBackEndModule.jar"
export log4j='/home/mas50o21/MessageReader/log4j.properties'
java -Xms160m -Xmx192m -cp "$CLASSPATH" com.mobiapps.seakey.emailclient.incoming.IncomingReader "$log4j"
can this be run as a service ?:
thanks
regards
shann
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have simple shell script that I run as cron job every hour of the day. I would like to make it a daemon that runs far more frequently like every 30 seconds or so, but I have never made daemon before. How can I do this?
-Sam (7 Replies)
Discussion started by: Sammy_T
7 Replies
2. Shell Programming and Scripting
Hi everybody,
Does somebody has a sample of script that control a daemon?
for example use loop until the daemon is on and if is not on
do something else?
Thanks
Pier (0 Replies)
Discussion started by: pierrelaval
0 Replies
3. Shell Programming and Scripting
Hi
I was going through one of my pjct script .Please let me know the logic for the deamon is running or not as i think the condtn should be vice-versa.
daemon_list = 'idp1278'
FAIL=0
for p in ${daemon_list}
do
fail=0
ps -fu workarea | grep ${p} > /dev/null 2>&1
if ] then
... (1 Reply)
Discussion started by: mani_isha
1 Replies
4. Shell Programming and Scripting
Hi,
HI ,
I have a simple script that moves files from one folder to another folder, I have already done the open-ssh server settings and the script is working fine and is able to transfer the files from one folder to another but right now I myself execute this script by using my creditianls to... (3 Replies)
Discussion started by: nks342
3 Replies
5. Shell Programming and Scripting
Hi,
I have one query that is suppose if I have a script that pick up some files from source folder and put it into destination folder , and I want this script to run after every 1 hour, to make it configurable as per that I have options like crontab and nohup but when I test this script I have to... (2 Replies)
Discussion started by: nks342
2 Replies
6. Shell Programming and Scripting
hi
I have the following script named ./daemonscript
while true
do
#echo string to file results
echo ok >> results
#commands
sleep 2
done
I call it the following way : ./daemonscript &
and I want it to stop when the user presses the "S" button together with... (5 Replies)
Discussion started by: vlm
5 Replies
7. Shell Programming and Scripting
Say i have a simple example:
root@server # cat /root/scripts/test.sh
while sleep 5
do
echo "how are u mate" >> /root/scripts/test.log
done
root@server #
Instead of using rc.local to start or another script to check status, I would like make it as daemon, where i can do the following:
... (2 Replies)
Discussion started by: timmywong
2 Replies
8. Shell Programming and Scripting
Hey guys,
I'm rather new to scripting with the shell (I started on Wednesday) and encountered a problem that left me clueless.
I moved to an old house recently and the sound of the 433mhz door bell is too quiet. Since I always wanted to start playing around with a raspberry pi and my wife... (11 Replies)
Discussion started by: matthes0815
11 Replies
9. Shell Programming and Scripting
Hi,
Can we integrate all the systemctl command into a shell script to verify any service with all the options of systemctl if service integrate with the operating system service management tools to deliver their functionality.
sudo systemctl start <service_name>
sudo systemctl stop... (1 Reply)
Discussion started by: Mannu2525
1 Replies
10. UNIX for Beginners Questions & Answers
My requirement is to run two scripts simultaneously.
Let say, script1.ksh is running in a loop :
example:
script1.ksh is:
for i in 1 2 3
do
script2.ksh 1 &
#psedu code which is required to write here
# if script 2.ksh is running, execute a script3.ksh (which actually check the... (2 Replies)
Discussion started by: sumitc
2 Replies