My script stops after logoff...why??

Hi'

i am runing a script thats run with a loop...while loop true.

when i exit the server..logon and again the script doenst run.

its a bash script test.sh.

i run it as:

#./test.sh &

what can be the priblem please?

thanks alot

See

man nohup
1 Like

ok and what about disown?

or disown -a? what does it mean?

Use disown if you forgot to start job with nohup. The -a option means all jobs that you have started.

Note disown is not available in all shells.

1 Like

if this is my code,where should i put the nohup?

#! /bin/bash
while true
do
   proc_num=$(ps a | grep yourscript | wc -l)
   echo "loop1: "proc_num=$proc_num
   sleep 2
   while (( $proc_num < 5 ))
      do
         echo "loop 2: "proc_num=$proc_num
         sleep 2
         yourscript &      #add a single process
      done
   echo " out of loop 1 "
   sleep 1
done
#let something else use the box done

Try calling the script itself with nohup:

nohup ./test.sh &

Please use code tags

1 Like

Great!! 10x alot