Tuesday, February 16, 2010

Creating background process using shell script

I faced a similar issue where trying to use '&' did not help to create a background process.

Finally I came to know of a command called screen which helps to create different type of sessions.

instead of using
'cmd &'

try using
'screen -d -m -s cmd'

in your script. This creates a detached session which runs in parallel as a separate process which can later be visited using the name given for the session.

There are many other options, look into 'man screen'.

Note: This command in the script works even when you have remote logged into the machine which has the script.

No comments:

Post a Comment