jimwhite Posted January 23, 2009 Share Posted January 23, 2009 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 ? Quote Link to comment
WeeboTech Posted January 23, 2009 Share Posted January 23, 2009 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 Quote Link to comment
Joe L. Posted January 23, 2009 Share Posted January 23, 2009 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.