Disable shell after starting process with shell script
I am trying to write a script to start the tomcat server that will be disconnected from the shell after the script finishes executing. For example, see Screenshot.
bash-3.00# ./startup.sh
Using CATALINA_BASE: /opt/tomcat/6.0.32
Using CATALINA_HOME: /opt/tomcat/6.0.32
Using CATALINA_TMPDIR: /opt/tomcat/6.0.32/temp
Using JRE_HOME: /opt/jdk1.6.0_26/
Using CLASSPATH: /opt/tomcat/6.0.32/bin/bootstrap.jar
bash-3.00# ps -eaf | grep tomcat
root 4737 2945 0 02:45:53 pts/24 0:00 grep tomcat
root 4734 29777 1 02:45:42 pts/24 0:19 /opt/jdk1.6.0_26//bin/java -Djava.util.logging.config.file=/opt/tomcat/6.0.32/c
Now, when you see that after the script finishes executing, the tomcat process is linked to pts / 24 until the shell is closed. But I want that even if the shell is open, the process should show behavior like below
bash-3.00# ps -eaf | grep tomcat
root 13985 2945 0 22:40:13 pts/24 0:00 grep tomcat
root 13977 29777 1 22:40:01 ? 0:22 /opt/jdk1.6.0_26//bin/java -Djava.util.logging.config.file=/opt/tomcat/6.0.32//
The operating system is Solaris. The various options I have used to achieve the same are using nohup and shutting down, but the process is shell related.
Another mechanism is to insert a crontab or use svc to start the process as soon as the system, i.e. the daemon, appears, or we can write a small C program that spins the process up and leaves.
Note here that the process is running in the background.
But I want to achieve the same using a shell or perl script. So any thought on this will help me a lot.
Thanks in advance.
source to share
Well, you could go and do all the hard work yourself, but why, when there is a module for that: Proc :: Daemon (Not of course if it runs on tanning beds)
The documentation also describes a process that is useful for you to understand if you decide to go ahead and create your own daemonizing code.
source to share