I have two files
file1 and
file2. Within
file2 I am running a daemon in the background as user
user1.
And I am executing this
file2 from within
file1, running
file1 as root. This creates two process one being executed as root and the other as
user1. However if add a
nohup before the invocation of the daemon in
file2, it shows only one process being run as
user1.
A little more explanation.
file1
file2
Code:
#!/bin/bash
sudo -u user1 java daemon &
and now ps aux gives..
Code:
root file2
user1 java daemon &
however adding a nohup to file2, like
Code:
nohup sudo -u user1 java daemon &
shows just one process running as
user1.