Starting a Process as a Non Root User on Startup under Linux

The following is a quick howto for when you want to fire up a process as a non-root user on boot under Linux:

Create a script, typically under /usr/bin with something similar to the following:

#!/bin/bash

# invoke your process

/usr/local/process/someprocess

exit

Now, add an entry to /etc/rc.d/rc.local to invoke the command as the non-root user

su – [non-root-user] -c [path-to-shell-script]

Make sure that the exit command is the last thing in the shell script so that you will exit → Continue reading “Starting a Process as a Non Root User on Startup under Linux”

Adding JBoss EJB3 Libraries/JBoss Runtime to the Build Path in Eclipse

When developing JavaEE applications in Eclipse it is more or less necessary to have all of the JavaEE libraries on the build path.

To do so, do the following:

  • Unpack the version of the JavaEE application server that you are using.  In this case it is JBoss 6.0.0.Final.
  • Run the ‘Add a Server’ wizard under the JavaEE perspective’s Server tab.
  • Add the Server Runtime to the build path/libraries:
  • Right-click on your project and select ‘Build Path/Configure Build Path’
  • Click on
Continue reading “Adding JBoss EJB3 Libraries/JBoss Runtime to the Build Path in Eclipse”

Too Many Open Files Errors When Using Runtime.exec() or ProcessBuilder.start() to Execute A Process

Java enables you to exectute a process on the host OS and to provide input (STDIN) to the process and read standard out (STDOUT) and standard error (STDERR).  Each time that you execute a process via Runtime.exec() or ProcessBuilder.start() STDIN, STOUT, and STDERR are piped to the running JVM as an OutputStream or InputStream.  For each stream there are two file descriptors and typically when the process terminates those streams are closed also closing the two file descriptors.

Even if → Continue reading “Too Many Open Files Errors When Using Runtime.exec() or ProcessBuilder.start() to Execute A Process”