Nohup Command | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Nohup Command

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-21-2005
blazix blazix is offline
Registered User
 
Join Date: Jan 2005
Last Activity: 24 January 2005, 9:57 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Nohup Command

Hello All,

I am newbie to unix.I am trying to use NOHUP command in shell script it works fine with only "nohup test.sh 10 &" and "/opt/user/nohup test.sh 10 &" gives an error saying "ksh: /opt/user/nohup : not found".

Can anybody please guide me to make it work.

Thanks
Blazix
Sponsored Links
    #2  
Old 01-21-2005
bhargav's Avatar
bhargav bhargav is offline Forum Advisor  
Registered User
 
Join Date: Sep 2004
Last Activity: 26 July 2012, 3:38 PM EDT
Location: USA
Posts: 512
Thanks: 0
Thanked 2 Times in 2 Posts
try finding where is your nohup location is and what is the PATH
you have for nohup.


try :

which nohup # will give the nohup you are using in the first instance.


# /opt/user/nohup may not be correct location.
Sponsored Links
    #3  
Old 01-21-2005
blazix blazix is offline
Registered User
 
Join Date: Jan 2005
Last Activity: 24 January 2005, 9:57 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
The nohup is the current working directory if given at the command line.
If I use in the shell script it is the home directory of the user ie., /opt/user is the default home dir for the user when he logins in.

I have hardcoded the path and also used as a variable but it still remains the same
    #4  
Old 01-21-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
Registered User
 
Join Date: Apr 2002
Last Activity: 29 September 2014, 9:17 AM EDT
Location: On my motorcycle
Posts: 3,093
Thanks: 1
Thanked 31 Times in 9 Posts
Please post your OS and version. Also post the output of
$ which nohup

Your post isn't making sense and with this information, maybe someone will be able to assist you. Thanks.
Sponsored Links
    #5  
Old 01-21-2005
blazix blazix is offline
Registered User
 
Join Date: Jan 2005
Last Activity: 24 January 2005, 9:57 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
#!/bin/ksh

# This script calls the weblogic start script if the file exist

if [ -f /opt/user/scripts/test.sh ]
then
echo "testing script"
su - username -c "nohup /opt/user/scripts/test.sh &"
exit $?
fi


#!/bin/ksh

# This script calls the test script if the file exist

if [ -f /opt/user/scripts/test.sh ]
then
HOME="/opt/user"
echo "testing script"
su - username -c "${HOME}/nohup /opt/user/scripts/test.sh &" // Error ksh:/opt/user/nohup:not found
exit $?
fi

I want the second script to be working.

Thanks
Sponsored Links
    #6  
Old 01-21-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
Registered User
 
Join Date: Apr 2002
Last Activity: 29 September 2014, 9:17 AM EDT
Location: On my motorcycle
Posts: 3,093
Thanks: 1
Thanked 31 Times in 9 Posts
Again, please post your OS and version, and the output of the following command:
$ which nohup

This will assist in getting you a answer. Since you seem to insist that /opt/user/nohup is a file on your server, please also post the output of these commands:
$ file /opt/user/nohup
$ ls -l /opt/user/nohup

I have reason to believe you are incorrect in using ${HOME}/nohup in the second script - I'm not sure why there would be a script or executable called nohup as this would be against most rules of programming (naming a script the same as a command). The first script seems to have the syntax correct:

su - username -c "nohup /opt/user/scripts/test.sh &"

since running a nohup command is done like that, and added to su - user would be correct. See the man page for su and nohup.
Sponsored Links
    #7  
Old 01-22-2005
blazix blazix is offline
Registered User
 
Join Date: Jan 2005
Last Activity: 24 January 2005, 9:57 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
please post your OS and version:HP-UX B.11.11

$ which nohup :/usr/bin/nohup //output

$ file /opt/user/nohup : cannot open
$ ls -l /opt/user/nohup : not found

Since the nohup.out is created when the command is executed hence the file does not exist for the above 2 commands


If nohup.out is not writable in the current directory, output is redirected to $HOME/nohup.out; otherwise, nohup fails.

I have reason to believe you are incorrect in using ${HOME}/nohup in the second script If nohup.out is not writable in the current directory, output is redirected to $HOME/nohup.out; otherwise, nohup fails.

I need the nohup to be written at the /usr/bin/.I am not whether I am clear or not.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ssh a nohup command headcr4sh Shell Programming and Scripting 2 12-01-2010 03:38 PM
Nohup command NycUnxer AIX 2 08-09-2010 10:58 AM
nohup command arvindng Shell Programming and Scripting 2 06-17-2009 10:40 AM
nohup command.. Amol21 UNIX for Dummies Questions & Answers 3 10-07-2008 11:45 AM
Nohup command on Solaris errolg UNIX for Dummies Questions & Answers 1 05-16-2002 11:44 AM



All times are GMT -4. The time now is 08:20 PM.