![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| reading ,writing,appending ,manipulating a file. | szchmaltz | UNIX for Dummies Questions & Answers | 4 | 06-17-2008 02:02 AM |
| Reading a file and writing the file name to a param file. | thebeginer | UNIX for Advanced & Expert Users | 1 | 10-05-2007 04:38 PM |
| reading/ writing to sockets | rein | Shell Programming and Scripting | 1 | 09-20-2007 08:57 PM |
| Reading and Writing file on LAN | lucky001 | High Level Programming | 3 | 03-30-2007 02:16 PM |
| Reading and Writing Files ? | tracydp | UNIX for Dummies Questions & Answers | 3 | 08-30-2006 10:24 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Log File Writing and Reading
Hi all,
I have the following shell script code which tries to sftp and writes the log into the log file. Code:
TestConnection ()
{
echo 'Connection to ' $DESTUSERNAME@$DESTHOSTNAME
$SETDEBUG
if [[ -a $SCRIPT ]]; then rm $SCRIPT ; fi
touch $SCRIPT
echo "cd" $REMOTEDIR >> $SCRIPT
echo "quit" >> $SCRIPT
chmod 700 $SCRIPT
sftp -b $SCRIPT $DESTUSERNAME@$DESTHOSTNAME > $SESSIONLOG
echo '**** FTP log reproduced below:'
echo '-----------------------------------------------------------'
cat $SESSIONLOG
echo '-----------------------------------------------------------'
}
Whereas the portion of script(cat $SESSIONLOG) does nothing.It prints nothing.Does anyone know what could be the problem?. I am new to unix and iam thinking is it because iam trying to cat from a file which might be still Open?If yes how do i get around it? Please help. Regards |
|
||||
|
Quote:
Thats correct Zaxxon. Adding sftp -b $SCRIPT $DESTUSERNAME@$DESTHOSTNAME > $SESSIONLOG 2>&1 did the trick....thanks a lot guys |
|
||||
|
One more question:
I want to compare the value of the variable against a string and i am using the below code,but doe's'nt seem to do it...is there anything wrong with it?? Code:
if echo "$PRECHECK" | grep 'FALSE';
then
echo "File Ftped Successfully: " $f
mv $f "FTPED_"$f
fi
Thanks |
|
||||
|
Quote:
I assume [ ! -z $PRECHECK ] means does the variable precheck exist?? One more thing is that I need to email the file log contents to a user. I am using the code below: Code:
cat $SESSIONLOG|mailx -s "Alert created on $DATERUN : Transaction date is $DATERUN : Interface failure from RCUK to BottomLine " $EMAILADD |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|