test.sh in /root/folder
#!/bin/bash echo "Hello" #Sample Code
Now in th same folder(/root/folder). I have created nohup_test.sh
#!/bin/bash while true do sh /root/folder/test.sh sleep 1 done
If ran the above file like this
nohup sh nohup_test.sh &. It will run in background and creates
nohup.out have the output of
test.sh which we can
tail -f nohup.out
Now I want the above script nohup_test.sh to run start startup(automatically run at startup of OS).
I have created another file
start.sh in same directory (/root/folder/)
#!/bin/bash nohup sh /root/folder/nohup_test.sh &
I followed one procedure HERE.
Add the entry like below
# This script is executed at the end of each multiuser runlevel /root/folder/start.sh || exit 1 # Added by me exit 0
I think script is starting(Checked with
ps aux | grep "nohup").But I didn't get the
nohup.out file. So, how can I get that file
nohup.out or I have to follow any procedure?