fretagi,
I know you've solved the problem in the meantime, but let me explain why >> /var/tmp/HLR_ftp.log is not sufficient to also redirect HLR01_21092014: No space left on device to the logfile.
With >> you are appending only stdout messages to the logfile. The "No space left ..." message is written to stderr. The solution is to redirect stderr to stdout, so stderr also goes to the logfile:
if you add the line like so;
Then run your script - you'll be able to see the exit code of "ftp" which I think will be "0"
Regards
Dave
Dave,
If you add that line of code there, you completely change the remaining logic of the script. The commands:
Will print the exit status of the ftp command, but set EXITSTATUS to the exit status of the echo command rather than the exit status of the ftp command. If there is some reason that you think the following if is not working correctly, the way to print ftp's exit status without changing the logic of the rest of the script would be:
Note that you can't use:
either because the echo would then be printing the exit status of the command assigning a value to the EXITSTATUS variable (which, barring significant hardware problems or lack of accessible memory, should always be zero).
I have put that script in a crontab, to get the file once a week, but how do I modify the script in order to that in the next run, he would not pick all files starting with HLR. The format of the file is HLRXX_MMDDYYYY, where XX is just a number.
Because the script has been hard coded to pickup the HLR files, you'll need to modify to pickup the files that you want for the next run.
@Don, I realise that that was the case, I just wasn't clear that the echo statement was only there for testing and should be removed afterwards - sometimes - especially when a user arrives at your desk and performs the "Headless Chicken Dance" it is difficult to be as involved with the forum as one would like.
Regards
Dave
Last edited by gull04; 09-24-2014 at 06:12 AM..
Reason: Typo
I have put that script in a crontab, to get the file once a week, but how do I modify the script in order to that in the next run, he would not pick all files starting with HLR. The format of the file is HLRXX_MMDDYYYY, where XX is just a number.
If you want just files with today's date, change:
to:
I have this UNIX script code with a query to export sql table in Oracle and export to csv file. The code gets the data correctly. However, when I run the script second time, I got the error message "not spooling currently" and shows the older data in csv file. When I delete the csv file and run... (5 Replies)
Greeting!!
I wrote the below script to e-mail me only file names in a specific directory when a file is delayed for some time in a that directory. I am getting unexpected eof error message.
I don't want any email if the folder is blank.(if the condition is not met) I am not getting the email at... (4 Replies)
I have one script that calls another script during execution. The other script does some processing, then either returns with exit 0 (if successful), or exits with error code numbers (if failed). However, in addition to the error code, I would like for that second script to be able to pass a... (4 Replies)
Hi,
I am writing a script in which I am using an IF-Else statement.
Code sample:
# Check for the product.
If (test "$3" = "Pet") Then
Product_Code="PI"
elif (test "$3" = "Breakdown") Then
Product_Code="RI"
elif (test "$3" = "Travel") Then
Product_Code="TI"
... (2 Replies)
Hi,
i've got a problem with a sendmail script, which sends HTML mails. Some mail will rejected by the mail server, because the fqdn doesn't exist.
Where can i set the sender-domainname by sendmail?
My mail server say: "Sender address rejected: Domain not found;", which is correct... (3 Replies)
Hello again all. I have a user editable script that I'd like to have point out the user error to. Problem is I'm having troubles getting an echoed error message to give me the line. Here's what I'm trying to do. grep -n $loc /this/script.sh where '$loc' is the argument passed to the script.... (9 Replies)
Hello All,
I am getting the following error message when trying to execute the following script.
AWK=/usr/bin/awk
TR=/usr/bin/tr
SED=/usr/bin/sed
CAT=/usr/bin/cat
MAILFILE=/home//nightly_jobs.tmp
mailto=xxx@gmail.com
Nigh_Status = `db2 "select TYPE from ETL.LOCK where STATUS <> 0 and... (12 Replies)
Hi All
this is a simple script
#! /bin/bash
FileCnt=`ls -lrt $DIR/* | wc -l`
echo $FileCnt
how could i escape the error msg if there are no files in $DIR
ls: /home/sayantan/test/files/cnt/*: No such file or directory
0
Looking forward for a quick reply
Regards, Newbie... (3 Replies)
Hi All,
When I am trying to execute the below shell script I got this error message.
script
==========
#!/bin/bash
/usr/java/jdk1.5.0_10/bin/java - classpath /var/lib/asterisk/agi-bin/mysql-connector-java-3.0.15-ga-bin.jar/:
/var/lib/asterisk/agi-bin/jarfiles:... (4 Replies)
Hi I have the following script and have problem debugging the problems. The function of this script is to make sure the entire file is being received (the filesize of a data is not changing after 20 seconds) and start moving the file to another directory. This script should be started every 30mins.... (5 Replies)