Nohup apending data each time i run script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Nohup apending data each time i run script
# 1  
Old 08-05-2016
Nohup apending data each time i run script

I have a problem here.
i am running my script in nohup but if i run it 2 or three time , in my output i see it is giving me old data as well, in-spite i delete
Code:
nohup.out

file.
i tried to look a lot from where the old data is coming.
can some one tell me how the old data is also coming again and again

and is there a way i can run 5 scripts in same with out a cron like in a daemon job?
Code:
nohup sh path/script.sh &


i have something like below in my script will it be creating a problem ?
Code:
DATE_3=`date | awk '{print $2,$3,$4}'


Last edited by mirwasim; 08-05-2016 at 04:02 PM..
# 2  
Old 08-05-2016
What is "old data"?

If you're running background jobs like above in parallel, all logging to the same file, it's no surprise their output shows up garbled in there.
# 3  
Old 08-05-2016
Quote:
Originally Posted by RudiC
What is "old data"?

If you're running background jobs like above in parallel, all logging to the same file, it's no surprise their output shows up garbled in there.

yes true.. i am running in parallel, so is there a way i can delete that
Code:
nohup

because i cant see where is that file.
and is there a way i can run all the scripts in parallel other than cron.?
# 4  
Old 08-05-2016
To tell you the truth, what you have shown us so far is of little help
as
Code:
DATE_3=`date | awk '{print $2,$3,$4}'

is just assigning DATE_3 with the wanted value...
We have no idea where and what output you are talking about as we have nothing else to view...

Using nohup is NOT for cron specifically it is more for backgrond processes to not depend on a terminal
And yes, you can execute (almost) in parallel 5 times the same script, only it will not solve your problem as Rudi already said if they write in the same file, it makes a mess...
This User Gave Thanks to vbe For This Post:
# 5  
Old 08-05-2016
all my scripts which are running in parallel are pointing to different directories.may be file name is same but different location.

for example: i scheduled a script in cron, when it ran it gave me 3 output in email,each output is few hours old.

when i run same script manually in its directory it run fine and give correct result.

now only some expert can advise whats happening here
# 6  
Old 08-05-2016
Show us the script! Without seeing the script we can only guess at dozens of things that various invocations of the script(s) might be doing to interfere with each other.

Show us the script!!!

Show us the command lines that are being used to invoke your script(s).

Show us the output your are getting.

Show us the output you are hoping to get.

Tell us what operating system you're using.

Tell us what shell you're using to run your script(s).

This is all very basic information that is needed to diagnose your problem. Please help us help you.
# 7  
Old 08-06-2016
Quote:
Originally Posted by Don Cragun
Show us the script! Without seeing the script we can only guess at dozens of things that various invocations of the script(s) might be doing to interfere with each other.

Show us the script!!!

Show us the command lines that are being used to invoke your script(s).

Show us the output your are getting.

Show us the output you are hoping to get.

Tell us what operating system you're using.

Tell us what shell you're using to run your script(s).

This is all very basic information that is needed to diagnose your problem. Please help us help you.

my script is of 230 lines including email.
shall i post whole script here?

and in side my script i am calling other .jmx script also and my script send result on the basis of out put from that script.

which is fine and run as expected which i run
Code:
sh -x script.sh

but when i schedule in cron it mess it up. it post old data also with time and data.
it is keeping old data some where is buffer.

i am using SUNOS

output in email, can i attach the same here?
i am using bash

Last edited by Don Cragun; 08-06-2016 at 12:54 PM.. Reason: Change some CODE tags to ICODE tags and add more ICODE tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell Script to run in given time

Hi All, Would like to write a Script which will run between 11am to 3 pm and send the results to output.txt. Please suggest. (2 Replies)
Discussion started by: vasuvv
2 Replies

2. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

3. Shell Programming and Scripting

Run a task in a script at a particular time

I have an ETL process that triggers a shell script. This script picks the files created by the ETL process and does an SFTP. These are huge files. Due to infrastructure limitations, we need to trigger the actual SFTP part only during the 2nd, 16th, 31st and 46th minute of an hour. Please let me... (2 Replies)
Discussion started by: vskr72
2 Replies

4. Shell Programming and Scripting

Time taken to run a SQL script

Hello I am asked to run around 5-6 SQL queries in a shell script and take a note of the time taken to execute each query to a file. How do I get the time taken to run the individual SQL queries (2 Replies)
Discussion started by: vat1kor
2 Replies

5. Shell Programming and Scripting

run shell script under nohup directly [solved]

Hi, i am not able to run the loop in nohup directly. nohup 'for i in $(seq 10); do echo $i;./mscript.sh $i; done' can some one help me how to run this directly in nohup? ---------- Post updated 03-15-12 at 12:20 AM ---------- Previous update was 03-14-12 at 11:59 PM ---------- From... (0 Replies)
Discussion started by: johninweb
0 Replies

6. UNIX for Dummies Questions & Answers

Run process with nohup every certain time

Hi, I need execute a script every 30 minutes. As might be done without using cron Thx. (6 Replies)
Discussion started by: pepeli30
6 Replies

7. Shell Programming and Scripting

Run Script With nohup Command On A Different Server

Hi, I want to run a particular script present in a different server. At the moment I am trying to run it like this: (sleep 3; echo $USERID; sleep 1; echo $PASSWORD ; sleep 1 ; sleep 1 ; echo "nohup perl myscript.pl $* &")| telnet "$server" But the problem is that once the script has... (6 Replies)
Discussion started by: King Nothing
6 Replies

8. Shell Programming and Scripting

last run time of any script

how to find when last time a scrit has ran? (7 Replies)
Discussion started by: RahulJoshi
7 Replies

9. Shell Programming and Scripting

run script for given time

Hi! I need to run my script for a specific number of time, as specified by the user: For instance, if the user specified 10, my script should run for until 10 seconds expire. How do I do this? (0 Replies)
Discussion started by: looza
0 Replies

10. Shell Programming and Scripting

Run script at same time

Hi My five script run throgh crontab at same time at 6 clock. Due to problem in the data load .Now I want to check time of load finish run these jobs. I create a script which check the load finish time but I have no idea how I run these JObs. This is very urget to me. Please reply me as soon... (3 Replies)
Discussion started by: Jamil Qadir
3 Replies
Login or Register to Ask a Question