Freezes up execution of the script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Freezes up execution of the script
# 1  
Old 06-12-2013
Freezes up execution of the script

My script that I wrote is no longer running, but just freezing when I execute it.
Before it was running and showing me where errors were, now when I execute it, nothing happens and i cant type anything into the command screen.

The script was a looping script, what could be going on?
# 2  
Old 06-12-2013
How do you expect us to tell what is wrong with your script without even seeing it!!

Post your script in code tags
# 3  
Old 06-12-2013
the error message is that this line

Code:
 if ["$date_of_file" -gt "$param"] ; then #Compare with the last saved parameter

has an unxpected EOF?

Last edited by Scrutinizer; 06-12-2013 at 03:17 PM.. Reason: code tags, not quote tags
# 4  
Old 06-12-2013
You need to put space around the square brackets:
Code:
if [ "$date_of_file" -gt "$param" ] ; then

# 5  
Old 06-12-2013
I tried that. It didn't work. I added spaces, then removed spaces....nothing made a difference
# 6  
Old 06-12-2013
Well without those spaces it is syntactically incorrect. If you added them, and it still did not work, then the error is elsewhere and you would need to post some more code.
# 7  
Old 06-12-2013
Awk: syntax error near my file names

Im currently getting a list of rather odd errors. I've tried everything, but as someone mentioned I prob need to past the code.

i get errors saying

Code:
usage: ssh [blah blah
awk: (my file name).txt
awk:                    ^syntax error
awk: (my file name).txt
awk:                    ^syntax error


and it repeats for every file.
Code:
# Read file cred.txt (with one IP per line), connect to servers (one at a time), and download directory listing
i=1
param=$(sed -n "{$1}p" /etldata/dev1/cdm/parm/cdm_param.txt) #Get the last saved parameter in cdm_param.txt (Date in format YYYYMMDD when the script was last successfully run)
param=$(date -d $param +%Y-%m) # Convert YYYYMMDD to YYYY-DD
while read line; do
	host=$line
	ssh $user@$host ls -l $directory $src_file_name$param'*' > ftpList$i.txt
	awk -F '{print substr($line,length($line)-13,10)}' ftpList$i.txt > Dates$i.txt #Save the date part of each file name
															  #in the directory listing downloaded previously.
	awk -F '{print substr($line,length($line)-30,27)}' ftpList$i.txt > Files$i.txt	#Save the name of each file.
		linenum=0 #Auxiliary variable for sed. Will be used to match the line where the condition is satisfied with the corresponding file.
		
		while read list; do
		linenum=$((linenum+1))
		date_of_file=$(date -d "$list" +%Y%m%d) #Convert the modification datetime of each file to format YYYYMMDD
		    if [ "$date_of_file" -gt "$param" ] ; then #Compare with the last saved parameter
			file=$(sed -n "${linenum}p" Files$i.txt)	#If the condition is satisfied, use sed to get the name of the file
														#in the same line of Files$i.txt.
		while read line2; do	#Connect again and download file when the above condition has been satisfied.
			sftp $user@$host <<END_RETRIEVE
			cd $was7sourcedir
			get $file
			quit
END_RETRIEVE
		done < 'cred.txt'
mv $file  home/p79793/FTPtest/$file'-0'$i #Rename file with its original name and append '-01', '-02', and so on, after the # of each server.	
		    fi
		done < Dates$i.txt
#rm ftpList$i.txt Dates$i.txt Files$i.txt #Delete auxiliary files. 																		   # REFER TO FILE jessica4.pdf TO SEE WHERE YOU HAVE TO 
																		   																	 
	i=$((i+1)) #Go to the next server
linenum=0
done < 'cred.txt'
echo $(date +'%Y%m%d') > /etldata/dev1/cdm/parm/cdm_param.txt 
rm cred.txt								  
exit 0


Last edited by Scott; 06-12-2013 at 04:04 PM.. Reason: Added one more code tag
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Script on Solaris spawning 2 processes for one shell script execution

Hi, I am having a shell script on Solaris 10 which has a while loop as shown below. #!/usr/bin/ksh # while do sleep 60 done Name of the shell script is coldcentric.sh. I executed script /DATAWAREHOUSE/LOAD/Scripts/coldcentric.sh from a command task in Informatica worklow as... (3 Replies)
Discussion started by: chekusi
3 Replies

2. Red Hat

system freezes / hangs

Hi, We're using - openldap-2.3.43-12.el5_6.5 nss_ldap-253-25.el5 on RHEL-5.5 Intermittently the entire system hangs, no message is present in any of the log files, login to the system fails, ssh fails, ping fails, the only way to recover is to hard-boot the system. We consulted... (3 Replies)
Discussion started by: TheRock
3 Replies

3. Emergency UNIX and Linux Support

invoke one script based on previous script execution

I am database guy and not very good at shell scripts. I am seeking help to sharp my script coding. I have 5 scripts 1. master script. I use this one to call other four scripts to do database work. 2. db_backup_1 and log_backup_1 3. db_backup_2 and log_backup_2 in master script, I want to... (4 Replies)
Discussion started by: duke0001
4 Replies

4. UNIX for Advanced & Expert Users

SSH using shell script terminates the script execution

Hello, I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes. ... (2 Replies)
Discussion started by: manaankit
2 Replies

5. Shell Programming and Scripting

AIX .ksh script freezes when using the mail -s command

Hello I am trying to send an email when a .KSH script is run on an AIX Machine. This email will only include a subject line that is made up of variables from within the script, and is as follows: CURRENT_DATE=`date +%Y%m%d` TIME=`date` ADMIN="myname@domain.com" date block () { ... (4 Replies)
Discussion started by: jimbojames
4 Replies

6. Gentoo

xorg constantly freezes

this is purely for posterity but it took me a while to find this solution online. 10.1 comes wanting to install the stable releases of xorg and the kernel. However on many platforms (especially with intel video) the result is an xorg that functions for a few minutes but then hangs up and prevents... (0 Replies)
Discussion started by: thmnetwork
0 Replies

7. Shell Programming and Scripting

Expect Issue Serial Forground Execution vs Concurrent Background Execution

I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test. The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies

8. UNIX for Dummies Questions & Answers

Fedora 7 freezes

Hi, Recently my Fedora running under level 3 begun freezing. It was running for about four months without any failures, but now it freezes almost every day, even twice a day. Sometimes it comes back itself, sometimes hard reboot is needed. This is a remote server where I connect through... (2 Replies)
Discussion started by: Georgy
2 Replies

9. Solaris

Solaris 10 freezes up while logging in.....!!!!

Hi all, I have installed Solaris along with Xp ....The installation was successful... I get the Grub menu displaying Solaris along with Win Xp....After i select Solaris the following happens, "Failed to initialize inband hotplug controller" The above message repeats three times & i get the... (2 Replies)
Discussion started by: codewarrior
2 Replies

10. SCO

Unixware 7.1.3 console freezes

I am using UnixWare 7.1.3 evaluation version and I have moved to network yesterday. I could able to ping and I tried to telnet to that server and i have user id,passwrd prompt then it was asking to buy the license . Today morning Console was frozen and I tried to reboot the server couple of times.... (0 Replies)
Discussion started by: visu101
0 Replies
Login or Register to Ask a Question