Jump to content

What's wrong with this go-script line?


jimwhite

Recommended Posts

It worked on my system.

Do you have end of line correct?

 

root@unraid /boot/bin #nohup nice /boot/bin/cached.sh >/dev/null 2>&1 </dev/null & 

[1] 8979

root@unraid /boot/bin #ps -f

UID        PID  PPID  C STIME TTY          TIME CMD

root      8973  8971  0 09:00 pts/0    00:00:00 -bash

root      8979  8973  0 09:02 pts/0    00:00:00 /bin/bash /boot/bin/cached.sh

root      8980  8979  0 09:02 pts/0    00:00:00 sleep 300

root      8981  8973  0 09:02 pts/0    00:00:00 ps -f

 

in my go script and my cached.sh test script I have the following as the first line.

#!/bin/bash

Link to comment

I thought this line wold launch cached.sh in the background and return to the command prompt but it doesn't....

 

nohup nice /boot/bin/cached.sh >/dev/null 2>&1 </dev/null &

 

Any ideas what is wrong ?

 

Here's a hint....

Question.   What command was run?

Answer:      nohup

 

Question: How was the command invoked?

Answer:   The "nohup" command was run in the background.   The "nohup" command had its standard input, output, and stderr connected to /dev/null.

 

The nohup then runs "nice" which in turn then runs "bash" that interprets the script.

 

Last question... how are you invoking this line?  Are you running it on the command line, or passing it through "fromdos" and then sending it to a "sh" process?

 

A lot has to do with which command is actually being put in the background with the "&"

 

A different approach (and one I just learned myself) might be:

nice cached.sh &

disown %1

 

Joe L.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...