It is currently Mon, 18 Mar 2024 18:11:57 GMT



 
Author Message
 FTP: 421 Service not available....
Hello all, I am running to this problem and I have no clue how to
solve it...if somebody can give me some ideas, I will really
appreciatted

I am trying to ftp a file. This is the process:

ftp -n nameofserver
user username password
cd /var/xx/xx/xx
ascii
put nameoffile
dir
bye

When i first do the ftp i get all this (I dont know if this is good or
bad):
220 bigbird FTP server (DG/UX Release R4.11MU06) ready.
500 Command not understood.
500 Command not understood.
KERBEROS_V4 rejected as an authentication type

Then I enter the username and password
and when I tried to put the file i get this message:
421 Service not available, remote server has closed connection
Passive mode refused.

Can this be a problem on the other end? I dont know what to do



 Tue, 01 Dec 2009 23:52:43 GMT   
 FTP: 421 Service not available....
I know that....thats why I put all my information in this post, so
maybe somebody in here already solved this problem.


 Wed, 02 Dec 2009 01:15:07 GMT   
 FTP: 421 Service not available....
   ^^^^^^^^^^^^^^^^^^^^
If it were me I'd try turning off passive mode.


 Wed, 02 Dec 2009 01:27:35 GMT   
 FTP: 421 Service not available....
How do I do that?


 Wed, 02 Dec 2009 04:26:54 GMT   
 FTP: 421 Service not available....
On Fri, 15 Jun 2007, in the Usenet newsgroup comp.os.linux.networking, in
article <1181922763.119526.308...@o61g2000hsh.googlegroups.com>, erick-flores
wrote:

Do you have permission to upload files to this server?

OK - but see below

Do you have permission to put files there?  /var/ is normally used for
system variable data, logs, and spools.

Well, the server doesn't like two commands you gave, though from the
sequence you show above, I have no idea what it is responding to.   The
KERBEROS_V4 protocol rejection suggests a configuration mismatch - again
no details to say what.

Obviously it doesn't like something you are trying, but you show no
context, so we have no idea what the responses are relating to. Try
cutting/pasting the console output so someone can SEE what you are doing
and what the server is doing in response. You can munge the server name,
username and password, but avoid doing any munging on the rest if you
expect people to understand your problem.

No context - no idea when this message was received. but the remote
server has already hung up the phone because it didn't like something
you said.

As this is not a "normal" anonymous FTP transfer, discuss the with the
administrator of the DGSUX box.

        Old guy



 Thu, 03 Dec 2009 07:54:04 GMT   
 FTP: 421 Service not available....

        Ie in this case, Google is pretty useless. It's interesting how
often people invoke the Google mantra, with useless suggestions like the
one above, as though they solved anything.

        If you want to help, rather than chastise the OP, do suggest a
useful approach to Google that returns a manageable number of hits. Of
course, that's much more difficult; on the other hand, any moron with
delusions can redirect anyone to Google.



 Thu, 03 Dec 2009 08:00:31 GMT   
 FTP: 421 Service not available....
On Jun 16, 6:54 pm, ibupro...@painkiller.example.tld (Moe Trin) wrote:

Thanks for your reply.

Here is whats happening and its getting more confused:
This ftp process runs from a crontab. It runs every day (mon-fri) @
19:30.  When it runs it fails. But then when i run (the exact same
script) manually @ 8.35 every morning it runs just fine. Can be
something wrong in the crontab then?

this is how my crontab looks like:
30 19 * * 1-5 /usr/local/bin/x.autoextract        # Extract orders

Any ideas?

Thanks



 Sat, 05 Dec 2009 01:54:49 GMT   
 FTP: 421 Service not available....

Could be time sensitivity on the ftp server.
Or environment dependencies in your script. cron jobs get a much smaller
set of env vars than do interactive jobs.
Try cron for 8:35 to tell for sure.
Check your scripts for env dependencies.
Post your script for further input.



 Sat, 05 Dec 2009 02:07:01 GMT   
 FTP: 421 Service not available....

OK, so here is my script that runs from the crontab. This script calls
another one (x.putcook) also posted below:

#!/bin/ksh

# Extract Cook orders that have been staged and send them to company

############################### CHANGE HISTORY
################################
# 06/14/07     Adapted to run properly on Linux.
# 01/10/07     Added logging.
# 11/12/04     Original version?
###############################################################################

function usage {
    print "\nUsage: $Prog [ <date> [ <database> ] ]" >&2
    print "\t<date> - Date to extract as mm/dd/yy. Default is current
date." >&2
    print "\t<database> - Name of the database to use. Default is
$DB." >&2
    print "\nExample:" >&2
    print "\t$Prog 01/05/07 tfhtst" >&2
    print "\nExtract for Jan 5, 2007 using database tfhtst." >&2
    print "" >&2

# Parm 1 = Date in the form MM/DD/YY
# Parm 2 = (optional) tfhtst (If you want to use the test database)
# ex: x.autoextract 03/01/04 tfhtst
# RUNNING WITH NO PARMS WILL EXTRACT FOR TODAY AND tfhbiz
# Setting some env vars...

# Log an event with date and time. Variable $LOG specifies the log
file.
function logit {
    if [[ $1 = '-' ]]
    then
        shift
    else
        print -- "$@" >&2
    fi
    print "$( date +'%Y-%m-%d %T' ) $@" >>$LOG

# Trap various errors
function irupt {
    case $1 in
        1 ) logit "1. Disconnect"
            trap "" 1
            ;;
        2 ) logit "2. Interrupt by user"
            trap "" 2
            ;;
        15 )
            logit "15. Operator (root) kill."
            trap "" 15
            ;;
        * ) logit "$1. Unrecognized interrupt."
            trap "" $1
            ;;
    esac
    exitfunc $1

function exitfunc {
    logit "End $Prog, Status $1, $NERR errors."
    rm -f $ERRTMP
    exit $1

# ############################### START MAIN
##################################

Prog=$( basename $0 )
Pname=$( basename $0 .sh )

ExtDir=/export/extracts/cook            # Location of extract file.
DB=tfhbiz                               # Default database.
ERRTMP=/tmp/$Pname.err                  # Temp file for error output.
LOG=/var/local/log/$Pname.log           # Log file
let NERR=0                              # Number of errors
encountered.

print "" >&2
if [[ $1 = '--' ]]
then
    print "Extract order for company, and send them to company's
computer." >&2
    usage
    exit 0
fi

# Trap various errors.
trap "irupt 1" 1
trap "irupt 2" 2
trap "irupt 15" 15

DTG=$( date +'%m/%d/%y' )               # The current date.
print "" >>$LOG                         # Put blank line in the log.
logit "Begin $Prog $@"

# Set some environment variables, if needed.
if [[ -z ${INFORMIXSERVER:-''} ]]
then
    logit "Setting Informix environment."
    . /etc/hudgins1.profile             # Set the Informix environment
fi
if [[ -z ${fg:-''} ]]
then
    logit "Setting FG environment."
    . /etc/fg.profile                   # Set the FG environment
fi

DT=${1:-$DTG}                           # Get date argument, if any.
DB=${2:-$DB}                            # Get 2nd argument, if any.

case $DB in
    tfhtst )
        CookDir=/m1/fourgen/accounting/oe.4gm/x_cook.tst
        ;;
    tfhbiz )
        CookDir=/m1/fourgen/accounting/oe.4gm/x_cook.tfh
        ;;
    * ) print "****  Unrecognized database \"$DB\"." >&2
        (( NERR += 1 ))
        ;;
esac

if [[ $NERR -ne 0 ]]
then
    usage
    exitfunc 17
fi

mm=$( print ${DT}|cut -c1-2 )
dd=$( print ${DT}|cut -c4-5 )
yy=$( print ${DT}|cut -c7-8 )
FileDate=${yy}${mm}${dd}                    # Date stamp
FileName=TFH$FileDate.txt                   # Extract file name.

# moving to the working directory...
cd $CookDir
logit "Running company Auto-Extract for $DT using $DB."
sleep 3
fglgo ./x_cook.4gi AUTOEXTRACT DB=$DB PRIN=C DATE=$DT >$ERRTMP 2>&1
let es=$?
if [[ $es -eq 0  &&  -s $ExtDir/$FileName ]]
then
    let NL=$( cat $ExtDir/$FileName | wc -l )
    let NL=$NL-1
    logit "Successfully extracted $NL orders."
else
    logit "****  Problem running x_cook.4gi [$es]."
    (( NERR += 1 ))
    let es=$es+16
    exitfunc $es
fi

chmod 664 $ExtDir/$FileName
logit "Transferring orders to company for $DTG."
sleep 3
/usr/local/bin/x.putcook $FileDate >$ERRTMP 2>&1
let ES=$?
if [[ $ES -eq 0 ]]
then
    logit "Successfully transferred extracted orders to company."
else
    logit "****  Problem transferring orders to company [$ES]."
    (( NERR += 1 ))
fi

exitfunc $ES

x.putcook <================this script starts here

#!/bin/ksh

# Send Extracts to the company computer.

################################## CHANGE HISTORY
#############################
# 06/14/07     Adapted to run under Linux.
# 02/28/07     Fix typo in function stmt. Add usage function.
# 03/12/04     Original version.
###############################################################################

function usage {
    print "\nUsage: $Prog <date>" >&2
    print "\t<date> - Date for file in the form yymmdd." >&2
    print "" >&2

# Parm 1 = YYMMDD file name
# x.putcook `date +%y%m%d`

function logit {
    if [[ $1 = '-' ]]
    then
        shift
    else
        print -- "$@" >&2
    fi
    print "$( date +'%Y-%m-%d %T' ) $@" >>$LOG

# Trap various errors
function irupt {
    case $1 in
        1 ) logit "1. Disconnect"
            trap "" 1
            ;;
        2 ) logit "2. Interrupt by user"
            trap "" 2
            ;;
        15 )
            logit "15. Operator (root) kill."
            trap "" 15
            ;;
        * ) logit "$1. Unrecognized interrupt."
            trap "" $1

;;
    esac
    exitfunc $1

function exitfunc {
    logit "End $Prog, Status $1, $NERR errors."
    rm -f $ERRTMP
    exit $1

################################## START MAIN
###############################

Prog=$( basename $0 )               # Program name.
Pname=$( basename $0 .sh )          # Program name w/o .sh extension,
if any.

ERRTMP=/tmp/$Pname.err              # Temp file for error output.
LOG=/var/local/log/$Pname.log       # Log file
let NERR=0                          # Number of errors encountered

if [[ $1 = '--' ]]
then
    print "\nTransmit the Cook extract file to the company computer."
    usage
    exit 0
fi

trap "irupt 1" 1
trap "irupt 2" 2
trap "irupt 15" 15

print "" >>$LOG                     # Put blank line in the log file
logit "Begin $Prog $@."

case $# in
    1 ) FILE=TFH${1}.txt            # Extract file to upload.
        ;;
    * ) logit "****  Missing required date argument."
        (( NERR ++ ))
        ;;
esac

if [[ $NERR -ne 0 ]]
then
exitfunc 17
fi

cd /export/extracts/cook            # Move to the extract directory.
if [[ ! -s $FILE ]]
then
    logit "****  Cannot fine $PWD/$FILE."
    (( NERR += 1 ))
    exitfunc 29
fi

let nb=$( cat $FILE | wc -l )       # Get byte count, just for the
record.

# The following FTP attempts two times to connect and send the file.
The first
# will probably fail with "421 Service not available...Turning off
passive
# mode." Upon reconnecting and logging in, the second put will
succeed.

ftp -n companyserver <<-EOF >$Pname.out 2>&1
    user username password
    cd /var/fs/home/branch/hudginsftp
    ascii
    put $FILE
    open companyserver
    user username password
    cd /var/fs/home/branch/hudginsftp
    ascii
    put $FILE
    dir
    bye
EOF

let es=$?                           # Capture the exit status from
FTP.

# The following grep command looks for the updloaded file in companys
directory.
# If found (exit status = 0), the transfer is assumed to be
successful.

if grep $FILE $Pname.out >/dev/null
then
    logit "Successfully uploaded $FILE to companyserver, $nb bytes."
else
    logit "**** Problem uploading $FILE [$es]."
    (( NERR += 1 ))
    let es=$es+64
fi
exitfunc $es

This script used to work with HP-UX, now that we moved to a Linux
server we tried to adapted but somehow is not working the right way.
Again this is the x.autoextract script that runs from the crontab. I
ran it yesterday at 20.30 and same result, it stop at: logit "****
Problem running x_cook.4gi [$es]." So it look like the problem/error
is in the x.putcook script. The weird thing is when i run it manually
in the morning and type the date argument for the last day, runs just
fine.
If you can take a quick look at this and let me know if you find
something out of place, please let me know.

Thanks in advance



 Sat, 05 Dec 2009 23:15:48 GMT   
 FTP: 421 Service not available....

Sorry I made a mistake the script stops at: ****  Problem transferring
orders to Cook [64]. not at: logit "****
Problem running x_cook.4gi [$es]."



 Sat, 05 Dec 2009 23:20:42 GMT   
 FTP: 421 Service not available....
On Mon, 18 Jun 2007, in the Usenet newsgroup comp.os.linux.networking, in
article <1182189289.228555.125...@o61g2000hsh.googlegroups.com>, erick-flores
wrote:

Do you know if the DGSUX ftp server has any access time limitations?

Most certainly yes. The environment in cron is SUBSTANTIALLY less than
in your shell.  Use the command 'set' to see the difference. As a user
on this system, I see

[compton ~]$ set | wc -l
     41
[compton ~]$

41 lines of settings. As root, it's 44. In a cron task, it's only 20
lines, and those "missing" lines constantly trap individuals. Another
common problem is the PATH - in cron, it's usually quite restricted
(perhaps only "/sbin:/bin:/usr/sbin:/usr/bin" - notice the lack of
"local" directories). Finally, though I'm not sure it's a problem,
cron doesn't "own" a terminal, so you may run into problems with where
'stdout' is going.

"/usr/local/bin" - this will _run_ OK, as long as _if_ it is calling
stuff that isn't in PATH, it calls it with a full pathname as you've
done in this crontab entry.

Second question - which crontab is this (system, or user?) and which
cron daemon in this. Neither here or in your original post do you
identify the Linux distribution and release.  For a _system_ crontab
(/etc/crontab) entry using 'vixie-cron' (the most common cron daemon),
there should be a variable between 'day-of-week' and 'command' that
identifies the user to run this job as. If this is an individual user's
crontab, OR if you are using 'dillon-cron' (found in Slackware and
clones), the username field should not be included (the way you show
this entry).

Note that neither 'vixie-cron' or 'dillon-cron' allow comments on
the individual command line - they are passed to the shell as if they
are part of the command, and that may not be what you desire.

        Old guy



 Sun, 06 Dec 2009 10:36:26 GMT   
 FTP: 421 Service not available....
Well it looks like its working now. I added the word *passive* to turn
off passive mode in the ftp process, and its working just fine.

Thanks for your help



 Sun, 06 Dec 2009 23:12:39 GMT   
 FTP: 421 Service not available....
On Tue, 19 Jun 2007, in the Usenet newsgroup comp.os.linux.networking, in
article <1182266148.409382.23...@q75g2000hsh.googlegroups.com>, erick-flores
wrote:

Oh, my - not many people are using the Korn shell - Hopefully Chris
Johnson will see this and comment.  I'm not an expert, and someone has
put a good bit of work in developing the script.    I'm assuming this
posting is showing the effects of line-wrap in your browser.

Does the log (/var/local/log/$Pname.log) show the script setting either of
these environments?

One has to wonder why this occurs. The script doesn't allow for anything
except the first failure/second success.  Why is it failing in the first
attempt?

Except for the fact that this sequence demands that the first attempt
fails, I don't see anything obvious.  Run a packet sniffer such as tcpdump
and capture the traffic. '/usr/sbin/tcpdump -n -s 1500 host companyserver'
will probably do the job.   The problem _SEEMS_ to be something in the
dialog to the server is incompatible - tcpdump should catch the dialog
between this script and the server (it should be in plain ASCII in crude
English), and you should then see what the server is barfing about. It
could be the expectation of first failure that is the problem.

Now I see your other reply that the word 'passiv' made things work, but if
this is done to the script, why is there a difference if the script is run
as a cron job verses running it from the command line.  Something still
smells fishy.

        Old guy



 Mon, 07 Dec 2009 04:12:30 GMT   
 
   [ 13 post ] 

Similar Threads

1. ftp 421 Service not available, remote server has closed connection

2. anon ftp:421 Service not available

3. ftp 421 remote service not available

4. FTP error: 421 Service Not Available

5. ftp error: 421 Service not available

6. ftp attempt = 421 Service not available

7. 421 Service not available FTP Error

8. A Strange problem - 421 Service not available, remote server has closed connection

9. 421 Service not available - something is doing this!

10. 421 Service not available


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software