05-20-2009
Problem in redirecting ftp msgs to a log file
Hi all..
The following set of statements is used in a shell script to ftp a file to a remote machine
Quote:
if [ $LGLFLAG = "T" ]
then
echo "$Machine $Password $ctlvar"
ftp -nv $Machine <<End_of_input
user "dhc\ftp-cognew" $Password
lcd /apps/lawson/fin/data
cd /ftp-cognew
$ctlvar
bye
End_of_input
>>$TmpLogFile
else
cat $TmpCtlFile | ftp -v $Machine >> $TmpLogFile
fi
cat $TmpLogFile
ftp_status=`grep -c $Success $TmpLogFile`
if [ $ftp_status -eq 0 ]
then
echo "\nERROR: problem occurred during $Action"
I want to redirect the ftp messages thrown by the first ftp statement to a log file. As you can see there is a logic downstream to decide if the ftp was a success or not. But i am not able to do so. As you can see since i have used '>>' the ftp messages are not getting redirected. Please help me in this
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, there. I am new to UNIX and I am writing a script that it uses the FTP to get a list of the files from the FTP server, and compares this list with the local folder to check if the file already exists. If not exist, then it connects to the FTP server again to download the files
The problem is... (1 Reply)
Discussion started by: czbtony
1 Replies
2. UNIX for Dummies Questions & Answers
Hi, I am new to this forum.
I have a problem and I ws hoping you guys can help me out here.
the problem: I have a batch job running on a Unix Server, and it transfers files from the unix server to another server. the series of commands are as follows:
> LS Listing the files
> Logging into... (4 Replies)
Discussion started by: Vanilmirth
4 Replies
3. Shell Programming and Scripting
% ls -ld /usr /foo
ls: /foo: No such file or directory
drwxr-xr-x 14 root wheel 512 May 18 02:49 /usr
% ls -ld /usr /foo 1>/dev/null/
/dev/null/: Not a directory.
% ls -ld /usr /foo 2>/dev/null/
/dev/null/: Not a directory.
^^Why why why doesn't this work for me. Furthermore, where is... (7 Replies)
Discussion started by: phpfreak
7 Replies
4. Solaris
summary found at bottom. to skip straight to action summary, ctrl+f for <summary>
this initially started with trouble changing passwords due to client being unable to authenticate, this was further caused by missing client files.
This was transparent to me, so this details the road I took,... (0 Replies)
Discussion started by: ProGrammar
0 Replies
5. Shell Programming and Scripting
Hi everybody,
i suddenly got in a requirement whereby:
I have to create a script whereby I need to connect with a remote server with a FTP script and search whether a file named filename.txt or *.txt exists or not in the remote server. If it exists then my script has to return a value.
... (18 Replies)
Discussion started by: RubinPat
18 Replies
6. Shell Programming and Scripting
Hi all,
I am fairly new to scripting, but I do try and script as much as possible but the more advanced stuff does tend to boggle my mind a bit.
I am at a bit of a loss with this one.
I get entries in my DNS logs, like the below:
I want to extract only the IP address, without the hashes... (5 Replies)
Discussion started by: codenjanod
5 Replies
7. Shell Programming and Scripting
Hi there,
I just want to know how can I redirect error msgs returned from running a command (e.g. nslookup) and then only print out the correct output using an if statement?.
I've tried the following:
where $a is a list of IPs.
but I got all the error msgs printed out to screen and... (9 Replies)
Discussion started by: Abdulelah
9 Replies
8. Shell Programming and Scripting
How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ?
Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies
9. Shell Programming and Scripting
I am trying to redirect record to two files using nawk if-else.
#Identify good and bad records and redirect records using if-then-else
nawk -F"|" '{if(NF!=14){printf("%s\n",$0) >> "$fn"_bad_data}else{printf("%s\n",$0) >> $fn}}' "$fn".orig
"$fn".orig is the source file name
bad... (7 Replies)
Discussion started by: siteregsam
7 Replies
10. Shell Programming and Scripting
I have a simple bash script that prints sth every 5 seconds. What I do is the following. I redirect the output of the script to a file, tail the file and see that it works and then from another console I delete the file where the output is redirected to. Even though I have deleted the file, the... (2 Replies)
Discussion started by: igurov
2 Replies
LEARN ABOUT SUSE
ftpd_selinux
ftpd_selinux(8) ftpd SELinux policy documentation ftpd_selinux(8)
NAME
ftpd_selinux - Security-Enhanced Linux policy for ftp daemons.
DESCRIPTION
Security-Enhanced Linux provides security for ftp daemons via flexible mandatory access control.
FILE_CONTEXTS
SELinux requires files to have a file type. File types may be specified with semanage and are restored with restorecon. Policy governs the
access that daemons have to files.
Allow ftp servers to read the /var/ftp directory by adding the public_content_t file type to the directory and by restoring the file type.
semanage fcontext -a -t public_content_t "/var/ftp(/.*)?"
restorecon -F -R -v /var/ftp
Allow ftp servers to read and write /var/tmp/incoming by adding the public_content_rw_t type to the directory and by restoring the file
type. This also requires the allow_ftpd_anon_write boolean to be set.
semanage fcontext -a -t public_content_rw_t "/var/ftp/incoming(/.*)?"
restorecon -F -R -v /var/ftp/incoming
BOOLEANS
SELinux policy is based on least privilege required and may also be customizable by setting a boolean with setsebool.
Allow ftp servers to read and write files with the public_content_rw_t file type.
setsebool -P allow_ftpd_anon_write on
Allow ftp servers to read or write files in the user home directories.
setsebool -P ftp_home_dir on
Allow ftp servers to read or write all files on the system.
setsebool -P allow_ftpd_full_access on
Allow ftp servers to use cifs for public file transfer services.
setsebool -P allow_ftpd_use_cifs on
Allow ftp servers to use nfs for public file transfer services.
setsebool -P allow_ftpd_use_nfs on
system-config-selinux is a GUI tool available to customize SELinux policy settings.
AUTHOR
This manual page was written by Dan Walsh <dwalsh@redhat.com>.
SEE ALSO
selinux(8), ftpd(8), setsebool(8), semanage(8), restorecon(8)
dwalsh@redhat.com 17 Jan 2005 ftpd_selinux(8)