Reputation: 17
how to run shell script in background in unix?
My script
#!/bin/sh
while [ true ]
do
ps -fu $USER>>/home/axway/trace.log 2>&1
sleep 10
done
running above script (shellEx1.sh
) in background by nohup
command on promt
nohup ./shellEX1.sh &
having below isuue:
$ nohup ./shellEX1.sh &
[3] 19520
$ nohup: ignoring input and appending output to `nohup.out'
Upvotes: 1
Views: 4434
Reputation: 8905
Its warning to say like the output of the script will be written in file 'nohup.out'. In order to remove this warning, you can try
nohup ./shellEX1.sh >/tmp/output.txt &
or
nohup ./shellEX1.sh >/dev/null &
Upvotes: 1
Reputation: 11
Just a thought, you could make it connect or create a screen instance at the start.
screen -S bashscript
my bash script
Upvotes: 0