Error while running script using nohup


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error while running script using nohup
# 1  
Old 01-13-2012
Error while running script using nohup

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
Code:
getStatus.sh: syntax error at line 3: `(' unexpected

. Can you let me know why it is so?


Code:
while [ 1 ]
do
. $(dirname $0)/include.sh
cd /var/app/integration/ 
for i in `du -a | grep -i version.txt | awk '{print $2}'`; do dos2unix $i $i; done;
cd ~/bin
./rmpadm > getStatus1.log
grep "FAILED" getStatus1.log > getStatus2.txt
FILE=~/bin/getStatus2.txt
echo $FILE
test
if [[ -s $FILE ]] ; then
SUBJECT="Automated Security Alert"
TO="xyz@abc.com"
MESSAGE="/export/home/admin/bin/getStatus2.txt"
/usr/bin/mailx -s "$SUBJECT" "$TO" < $MESSAGE
else
 echo " No failed services "
fi;
sleep 900
done

# 2  
Old 01-13-2012
nohup invokes the /bin/sh shell. It does not support the $( ) construct.

Add a shebang to the top of your code
Code:
#!/bin/ksh
#!/bin/bash

I don't know which shell you use/have on your system.
# 3  
Old 01-13-2012
Quote:
for i in `du -a | grep -i version.txt | awk '{print $2}'`; do dos2unix $i $i; done;
Noticed that this line will ONLY produce ONE filename and that will just be the first file in the directory regardless of its name. Also, the syntax for "dos2unix" is wrong.
What (in words) is the line meant to do?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nohup not give expected output. Non-stop running process

Hello, I am trying to make a bash script, I tested nohup but it did not help me. My code is: ffmpeg -i $input_url -c:v copy -c:a copy -listen 1 -f mpegts http://localhost:port/live/test When I open it in VLC, it starts feeding my screen and I see bitrate values. When I stop watching it,... (4 Replies)
Discussion started by: baris35
4 Replies

2. Shell Programming and Scripting

Running nohup command on remote server

I am having an issue in running a nohup command in a remote linux box from a linux box. Here are the details. Linux Machine 1: I have a script which starts a services and dumps the output into a log file. nohup sh weblogic.sh >> /home/log.out & I have placed the entire command in a... (2 Replies)
Discussion started by: accessbalaji
2 Replies

3. Shell Programming and Scripting

Keep a script on remote machine running (nohup?)

Hi, I'm using expect to ssh into remote machine (i know its not the best practice), and run script "script.sh". This "script.sh" checks whether an other process (some another script) is running and if not, it runs it as some other user. #!/bin/bash /usr/bin/expect << EOD set... (5 Replies)
Discussion started by: oseri
5 Replies

4. UNIX for Advanced & Expert Users

Running process in nohup

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)
Discussion started by: arunkumar_mca
5 Replies

5. UNIX for Dummies Questions & Answers

How to get a timestamp when running nohup & from a shell?

Hi, I am running nohup cp & in a shell script. How do I get a timestamp so I can get a timing of how long the copy took? Roughly, the script does something like below: date nohup cp -rp /files/source /files/target & date I am mainly wanting to know how long it took for the... (9 Replies)
Discussion started by: newbie_01
9 Replies

6. Shell Programming and Scripting

How to pause process running under nohup?

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)
Discussion started by: useless79
3 Replies

7. UNIX for Dummies Questions & Answers

Error running a script in nohup mode

Hi, running this script in normal mode, no error occours #!/usr/bin/ksh VALUE=0 SUBJECT='sub' ADDRESSES="aaa@gmail.com" BODY='body' while true do COUNT=$(tail -2500 /log/file.log | grep -i "error" | wc -l) if ; then echo "$BODY" | mailx -s "$SUBJECT" "$ADDRESSES"... (3 Replies)
Discussion started by: nash83
3 Replies

8. UNIX for Dummies Questions & Answers

How to restrict the execution of same script if it is running already in nohup?

Hi, How can i restrict the execution of same script if it is running already in nohup Thanks (1 Reply)
Discussion started by: ranabhavish
1 Replies

9. Shell Programming and Scripting

Shell running with nohup not work, but with sh command yes..

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)
Discussion started by: joaco
3 Replies

10. AIX

Query on running script with nohup

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)
Discussion started by: vkcool.17
2 Replies
Login or Register to Ask a Question