Can I re-direct nohup to a different filename?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Can I re-direct nohup to a different filename?
# 1  
Old 07-18-2013
Can I re-direct nohup to a different filename?

Hi,

I want to be able to run a script nohup & but I want the output file named like <script>.out instead of nohup.out. Is there anyway to achieve this?

At the moment, workaround is I cd to a different directory and then do nohup <script> &.

So far, I've tried below but it does not seem to work or maybe I am not doing it currently.

Code:
[user01@test01 ~]$ nohup ./x.ksh & 1>x.ksh.out 2>&1
[1] 8113
[user01@test01 ~]$ nohup: appending output to `nohup.out'

[1]+  Done                    nohup ./x.ksh
[user01@test01 ~]$ cat x.ksh.out
[user01@test01 ~]$ cat nohup.out
testing nohup.out
testing nohup.out
testing nohup.out
testing nohup.out
testing nohup.out
[user01@test01 ~]$ cat x.ksh
#!/bin/ksh
echo "testing nohup.out"
echo "testing nohup.out"
echo "testing nohup.out"
echo "testing nohup.out"
echo "testing nohup.out"
[user01@test01 ~]$

Feedback much appreciated. Thanks in advance.
# 2  
Old 07-18-2013
execute it as

Code:
 
nohup ./x.ksh > x.ksh.out 2>&1 &

# 3  
Old 07-18-2013
man nohup:
Quote:
If standard input is a terminal, redirect it from /dev/null. If standard output is a terminal, append output to 'nohup.out' if pos‐
sible, '$HOME/nohup.out' otherwise. If standard error is a terminal, redirect it to standard output. To save output to FILE, use
'nohup COMMAND > FILE'.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Saving nohup output to a file other than nohup.out

Shell : bash OS : Oracle Linux 6.4 I want to save the ouput of a nohup command to file other than nohup.out . Below are my 3 attempts. For both Attempt1 and Attempt2 , the redirection logs the output correctly to the output file. But I get the error "ignoring input and redirecting stderr to... (7 Replies)
Discussion started by: kraljic
7 Replies

2. Shell Programming and Scripting

Manipulating sed Direct Input to Direct Output

Hi guys, been scratching round the forums and my mountain of resources. Maybe I havn't read deep enough My question is not how sed edits a stream and outputs it to a file, rather something like this below: I have a .txt with some text in it :rolleyes: abc:123:xyz 123:abc:987... (7 Replies)
Discussion started by: the0nion
7 Replies

3. Programming

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My code: if then set "subscriber" "promplan" "mapping" "dedicatedaccount" "faflistSub" "faflistAcc" "accumulator"\ "pam_account"; for i in 1 2 3 4 5 6 7 8;... (0 Replies)
Discussion started by: aealexanderraj
0 Replies

4. UNIX for Dummies Questions & Answers

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My Requirement: 1) There are some set of files in a directory like given below OTP_UFSC_20120530000000_acc.csv OTP_UFSC_20120530000000_faf.csv OTP_UFSC_20120530000000_prom.csv... (0 Replies)
Discussion started by: aealexanderraj
0 Replies

5. Shell Programming and Scripting

Connect:Direct

Hello all, I have a requirement to transfer files to mainframe usinf NDM connect:direct. So can anybody provide me a sample shell script on how to call a connect;direct script by providing filename as a parameter please? Thanks, Ajay (0 Replies)
Discussion started by: ajaykumar4534
0 Replies

6. UNIX for Dummies Questions & Answers

re-direct to log file

#!/bin/ksh -x cd /tmp/tj ftp -n servername.com << DONE user username password as put test.log quit close DONE echo "testing..." sh -x scriptname, and it shows all, but username, as, put, quit, close, DONE. how can i see those ? (1 Reply)
Discussion started by: tjmannonline
1 Replies

7. Solaris

Direct login without password

Hi, I am trying to setup direct login from server test1 (Solaris 10) to server test2 (Solaris 9) using id taops (ldap id). Process Followed on Test 2. created .rhosts file in home directory of user taops geneted public key on test1 and appended to authorized keys on test2. Now trying... (8 Replies)
Discussion started by: tuxian
8 Replies

8. Shell Programming and Scripting

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
3 Replies

9. Web Development

How to detect browser and re-direct

I want to put some HTML code on my page that will detect the user who goes to my site's browser, and if it's a certain browser (like Internet Explorer or Mozilla Firefox), it will re-direct them to another page I have. How can I do this? (2 Replies)
Discussion started by: guitarscn
2 Replies

10. Shell Programming and Scripting

gzcat into awk and then change FILENAME and process new FILENAME

I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies
Login or Register to Ask a Question