Hi,
Do I execute it with "java undelivered &" in shell to make it execute in the background?
Yes, that would probably work. However this means that you have to manually start it every time your computer restarts.
Probably better to create a script in /etc/rc.d/init.d/ that you can use to start it, stop it, and check it's status. Let's call that script "mailCheck". Here is a sample script that I use to start my
J2EE server:
Some things to note:
I use sudo to force my J2EE server to run as user "apache". I do not want it running as user "root" (the default). In my sudoers file, I have set it up so that root can run the j2ee server as user apache without being asked for a password. If you want to know why not to run this as root, just ask.Note that you will have to set any required environmental variables inside this startup script - the script will be run with a very limited path and very few of what you would consider "standard" variables So anytime you want to start your application, you could type <code>/etc/init.d/mailCheck start</code>. When you want to stop it you can type <code>/etc/init.d/mailCheck stop</code>. To check whether it is running, you can type <code>/etc/init.d/mailCheck status</code>.
Then you can go into the dirctory for your run level. Since you are not running the X Windows System, you are probably using run level 3. So you would go into the /etc/rc.d/rc3.d/ directory and create a start up and shut down symbolic link back to your /etc/rc.d/init.d/mailCheck program. Start up links start with the letter "S" followed by a number followed by the script name. The number indicates the order for scripts to start. So you would want this to start sometime after your MTA starts (mine starts with S80sendmail) so you might create a start up script with the name S81mailCheck. The shut down scripts work the same way, except they start with a K (for kill). You would want your script to shut down before your MTA shuts down (mine shuts down with K30sendmail) so possibly something like K29mailCheck.
So now your script will start whenever the operating system starts, and shut down whenever the operating system shuts down.
Did I loose you in this? If so where?
Regards, Andrew