I want to be able to use several nohup & in the shell script so as not having to wait for the one cp to complete to proceed with the next cp.
But as you pointed I can take out the nohup and run nohup the shell itself and I will get the timestamp.
Just want to make sure I understand what you mean by not using nohup &. If let's say I have several scripts name x1.sh, x2.sh that contains line like below:
Then I should be able to run each of them as below and get the date output, is that correct?
Thanks in advance.
Right idea, wrong syntax. The order of redirections matter. The redirections have to come before the ampersand that terminates the command. You don't want both scripts writing dates to the same file or you won't know which dates came from which commands (assuming you used >> instead of >; using > may cause you to just get one date from one script and one date from the other script and you won't know which date came from either script).
The following probably does what you want:
Also note that in your scripts:
will use /bin/ksh to interpret the script on some systems and will try to use/ksh from a machine on your network with hostname bin on other systems. Use:
instead.
And, in both cases, I'm assuming that the 2nd line you show in the scripts:
is the name of the file containing the other lines in the script; not a line of code to be executed.
Then I run x.ksh
I am hoping to get some output from the .out file but I got nothing
I tried running the nohup manually from the command line. Same result, i.e. blank .out files.
Or do I simply have the first & in the wrong place
As I said before; you simply have every redirection and the ampersand in the wrong place. Try:
First, redirect the standard error output from the script to the same file descriptor that gets standard output from the script (2>&1). Then redirect the standard output from the script to a file for that script (>filename). Then run the command in the background (&).
Hi All,
I am facing issue in running a process in nohup. I ran a process in terminal since it is taking too long to complete I need to make it as background and nohup. I tried below and was able to make it in back ground
1. Cntrl + Z
2. bg
I am using Korn Shell so disown is not working... (5 Replies)
Hi ALL,
Is there any way to pause a running process under nohup ?
I have fired a build commands with required flags under nohup as below. now how can
I pause the started build process.
nohup make DEVICE=ap DEBUG=1 &
I understand we can use ctrl + z to pause a foreground process... (3 Replies)
why, when i run my shell with sh command it run without problem, but when run with nohup nombreshell.sh $ command not run correctly... values obtained from database are not displayed in the csv file.
My shell do that:
1° data base access with sqlplus:
read_sql_stmt() {
typeset stmt=$1... (3 Replies)
Hi,
I am running the below script. When i run the script normally it executes fine but when i run the same script using nohup it throws an error as getStatus.sh: syntax error at line 3: `(' unexpected . Can you let me know why it is so?
while
do
. $(dirname $0)/include.sh
cd... (2 Replies)
when i have a function definition and function call in my script , i am unable to run my script in background with nohup..
Help me out please..... (3 Replies)
Hi,
I'm trying to run database restore script with the nohup command as it will run for long hours since if I run it normally, the putty session will become inactive and the restore gets terminated. The command I use is
nohup db2 -tvf FBR_NODE0000.scr -z FBR_NODE0000.log &
But the problem is... (2 Replies)
Hi everyone -
I'm trying to start a run of LAMMPS (which takes an input file) with mpiexec on multiple processors. I want to combine this with nohup so that I can log off the node. I've used the syntax below successfully on one cluster, but it doesn't work on the new one I'm using. Any... (0 Replies)
Hi all,
I have one script test.sh for which I pass two arguments. In the same script I need to submit this script in background using nohup. My script like this and it is working in HP-UX os but not Solaris.
#! /bin/sh
if
then
MTR_PID=$$
export MTR_PID
echo "test.sh $1 $2... (3 Replies)