{
    "content": [
        {
            "type": "text",
            "text": "# ncftpspooler (man)\n\n## NAME\n\nncftpspooler - Global batch FTP job processor daemon\n\n## SYNOPSIS\n\nncftpspooler -d [options]\nncftpspooler -l [options]\n\n## DESCRIPTION\n\nThe ncftpspooler program evolved from the ncftpbatch program.   The  ncftpbatch  program  was\noriginally designed as a ``personal FTP spooler'' which would process a single background job\na particular user and exit when it finished; the  ncftpspooler  program  is  a  ``global  FTP\nspooler'' which stays running and processes background jobs as they are submitted.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **OPTIONS** (6 subsections)\n- **DESCRIPTION**\n- **JOB FILE NAMES**\n- **JOB FILE CONTENTS**\n- **DIAGNOSTICS**\n- **BUGS**\n- **AUTHOR**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ncftpspooler",
        "section": "",
        "mode": "man",
        "summary": "ncftpspooler - Global batch FTP job processor daemon",
        "synopsis": "ncftpspooler -d [options]\nncftpspooler -l [options]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "-d",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-q",
                "long": null,
                "arg": null,
                "description": "fault directory, /var/spool/ncftp."
            },
            {
                "flag": "-o",
                "long": null,
                "arg": null,
                "description": "rather inappropriately) the program simply uses a file called log in the job queue directory. If you don't want a log, use this option to specify /dev/null."
            },
            {
                "flag": "-l",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-s",
                "long": null,
                "arg": null,
                "description": "see if a new job has been submitted. Use this option to change the number of seconds used for this delay."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "ncftpbatch",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ncftpbatch/1/json"
            },
            {
                "name": "ncftp",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ncftp/1/json"
            },
            {
                "name": "ncftpput",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ncftpput/1/json"
            },
            {
                "name": "ncftpget",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ncftpget/1/json"
            },
            {
                "name": "uucp",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/uucp/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Command line flags:",
                        "lines": 1
                    },
                    {
                        "name": "-d",
                        "lines": 1,
                        "flag": "-d"
                    },
                    {
                        "name": "-q",
                        "lines": 2,
                        "flag": "-q"
                    },
                    {
                        "name": "-o",
                        "lines": 3,
                        "flag": "-o"
                    },
                    {
                        "name": "-l",
                        "lines": 1,
                        "flag": "-l"
                    },
                    {
                        "name": "-s",
                        "lines": 3,
                        "flag": "-s"
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "JOB FILE NAMES",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "JOB FILE CONTENTS",
                "lines": 145,
                "subsections": []
            },
            {
                "name": "DIAGNOSTICS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "ncftpspooler - Global batch FTP job processor daemon\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "ncftpspooler -d [options]\n\nncftpspooler -l [options]\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Command line flags:",
                        "content": ""
                    },
                    {
                        "name": "-d",
                        "content": "",
                        "flag": "-d"
                    },
                    {
                        "name": "-q",
                        "content": "fault directory, /var/spool/ncftp.\n",
                        "flag": "-q"
                    },
                    {
                        "name": "-o",
                        "content": "rather  inappropriately)  the  program simply uses a file called log in the job queue\ndirectory.  If you don't want a log, use this option to specify /dev/null.\n",
                        "flag": "-o"
                    },
                    {
                        "name": "-l",
                        "content": "",
                        "flag": "-l"
                    },
                    {
                        "name": "-s",
                        "content": "see if a new job has been submitted.  Use this option to change the number of seconds\nused for this delay.\n",
                        "flag": "-s"
                    }
                ]
            },
            "DESCRIPTION": {
                "content": "The ncftpspooler program evolved from the ncftpbatch program.   The  ncftpbatch  program  was\noriginally designed as a ``personal FTP spooler'' which would process a single background job\na particular user and exit when it finished; the  ncftpspooler  program  is  a  ``global  FTP\nspooler'' which stays running and processes background jobs as they are submitted.\n\nThe job queue directory is monitored for specially-named and formatted text files.  Each file\nserves as a single FTP job.  The name of the job file contains the type of FTP  job  (get  or\nput),  a  timestamp  indicating the earliest the job should be processed, and optionally some\nadditional information to make it easier to create unique job files (i.e. a sequence number).\nThe  contents  of the job files have information such as the remote server machine to FTP to,\nusername, password, remote pathname, etc.\n\nYour job queue directory must be readable and writable by the  user  that  you  plan  to  run\nncftpspooler as, so that jobs can be removed or renamed within the queue.\n\nMore  importantly,  the user that is running the program will need adequate privileges to ac‐\ncess the local files that are involved in the FTPing.  I.e., if your spooler is going  to  be\nprocessing jobs which upload files to remote servers, then the user will need read permission\non the local files that will be uploaded (and directory access permission the parent directo‐\nries).   Likewise,  if your spooler is going to be processing jobs which download files, then\nthe user would need to be able to write to the local directories.\n\nOnce you have created your spool directory with appropriate permissions and  ownerships,  you\ncan run ncftpspooler -d to launch the spooler daemon.  You can run additional spoolers if you\nwant to process more than FTP job from the same job queue directory simultaneously.  You  can\nthen  monitor the log file (i.e., using tail -f ) to track the progress of the spooler.  Most\nof the time it won't be doing anything, unless job files have appeared in the job  queue  di‐\nrectory.\n",
                "subsections": []
            },
            "JOB FILE NAMES": {
                "content": "When  the ncftpspooler program monitors the job queue directory, it ignores any files that do\nnot follow the naming convention for job files.  The job files must be prefixed in the format\nof  X-YYYYMMDD-hhmmss where X denotes a job type, YYYY is the four-digit year, MM is the two-\ndigit month number, DD is the two-digit day of the month, hh is the two-digit hour of the day\n(00-23),  mm is the two-digit minute, and ss is the two-digit second.  The date and time rep‐\nresent the earliest time you want the job to be run.\n\nThe job type can be g for a get (download from remote host), or p for  aput (upload to remote\nhost).\n\nAs  an example, if you wanted to schedule an upload to occur at 11:45 PM on December 7, 2001,\na job file could be named\n\np-20011207-234500\n\nIn practice, the job files include additional  information  such  as  a  sequence  number  or\nprocess ID.  This makes it easier to create unique job file names.  Here is the same example,\nwith a process ID and a sequence number:\n\np-20011207-234500-1234-2\n\nWhen submitting job files to the queue directory, be sure to use a dash character  after  the\nhhmmss field if you choose to append any additional data to the job file name.\n",
                "subsections": []
            },
            "JOB FILE CONTENTS": {
                "content": "Job  files  are  ordinary  text files, so that they can be created by hand.  Each line of the\nfile is a key-pair in the format variable=value, or is a comment line beginning with  an  oc‐\ntothorpe character (#), or is a blank line.  Here is an example job file:\n\n# This is a NcFTP spool file entry.\njob-name=g-20011016-100656-008299-1\nop=get\nhostname=ftp.freebsd.org\nxtype=I\npassive=1\nremote-dir=pub/FreeBSD\nlocal-dir=/tmp\nremote-file=README.TXT\nlocal-file=readme.txt\n\nJob  files are flexible since they follow an easy-to-use format and do not have many require‐\nments, but there are a few mandatory parameters that must appear for the spooler to  be  able\nto process the job.\n\nop      The operation (job type) to perform.  Valid values are get and put.\n\nhostname\nThe  remote host to FTP to.  This may be an IP address or a DNS name (i.e.  ftp.exam‐\nple.com).\n\nFor a regular get job, these parameters are required:\n\nremote-file\nThe pathname of the file to download from the remote server.\n\nlocal-file\nThe pathname to use on the local server for the downloaded file.\n\nFor a regular put job, these parameters are required:\n\nlocal-file\nThe pathname of the file to upload to the remote server.\n\nremote-file\nThe pathname to use on the remote server for the uploaded file.\n\nFor a recursive get job, these parameters are required:\n\nremote-file\nThe pathname of the file or directory to download from the remote server.\n\nlocal-dir\nThe directory pathname to use on the local server to contain the downloaded items.\n\nFor a recursive put job, these parameters are required:\n\nlocal-file\nThe pathname of the file or directory to upload to the remote server.\n\nremote-dir\nThe directory pathname to use on the remote server to contain the uploaded items.\n\nThe rest of the parameters are optional.  The spooler will attempt to use reasonable defaults\nfor these parameters if necessary.\n\nuser    The  username  to  use  to login to the remote server.  Defaults to ``anonymous'' for\nguest access.\n\npass    The password to use in conjunction with the username to login to the remote server.\n\nacct    The account to use in conjunction with the username to login to  the  remote  server.\nThe need to specify this parameter is extremely rare.\n\nport    The  port number to use in conjunction with the remote hostname to connect to the re‐\nmote server.  Defaults to the standard FTP port number, 21.\n\nhost-ip The IP address to use in conjunction with the remote hostname to connect to  the  re‐\nmote  server.  This parameter can be used in place of the hostname parameter, but one\nor the other must be used.  This parameter is commonly included along with the  host‐\nname parameter as supplemental information.\n\nxtype   The  transfer  type to use.  Defaults to binary transfer type (TYPE I).  Valid values\nare I for binary, A for ASCII text.\n\npassive Whether to use FTP passive data connections (PASV) or  FTP  active  data  connections\n(PORT).   Valid  values  are  0  for active, 1 for passive, or 2 to try passive, then\nfallback to active.  The default is 2.\n\nrecursive\nThis can be used to transfer entire directory trees.  By default, only a single  file\nis transferred.  Valid values are yes or no.\n\ndelete  This  can  be used to delete the source file on the source machine after successfully\ntransferring the file to the destination machine.  By default, source files  are  not\ndeleted.  Valid values are yes or no.\n\njob-name\nThis  isn't  used by the program, but can be used by an entity which is automatically\ngenerating job files.  As an example, when using the -bbb flag with ncftpput, it cre‐\nates  a  job file on stdout with a job-name parameter so you can easily copy the file\nto the job queue directory with the suggested job name as the job file name.\n\npre-ftp-command\n\npost-ftp-command\nThese parameters correspond to the -W, and -Y options of ncftpget and  ncftpput.   It\nis  important  to note that these refer to RFC959 File Transfer Protocol commands and\nnot shell commands, nor commands used from within /usr/bin/ftp or ncftp.\n\npre-shell-command\n\npost-shell-command\nThese parameters provide hooks so you can run a custom program when an item  is  pro‐\ncessed by the spooler.  Valid values are pathnames to scripts or executable programs.\nNote that the value must not contain any command-line arguments -- if you want to  do\nthat,  create a shell script and have it run your program with the command-line argu‐\nments it requires.\n\nGenerally speaking, post-shell-command is much more useful than  pre-shell-command  since  if\nyou need to use these options you're more likely to want to do something after the FTP trans‐\nfer has completed rather than before.  For example, you might want  to  run  a  shell  script\nwhich pages an administrator to notify her that her 37 gigabyte file download has completed.\n\nWhen  your  custom program is run, it receives on standard input the contents of the job file\n(i.e. several lines of variable=value key-pairs), as well as additional data the spooler  may\nprovide, such as a result key-pair with a textual description of the job's completion status.\n\npost-shell-command update a log file named /var/log/ncftpspooler.\n\n#!/usr/bin/perl -w\n\nmy ($line);\nmy (%params) = ();\n\nwhile (defined($line = <STDIN>)) {\n$params{$1} = $2\nif ($line =~ /^([^=\\#\\s]+)=(.*)/);\n}\n\nif ((defined($params{\"result\"})) &&\n($params{\"result\"} =~ /^Succeeded/))\n{\nopen(LOG, \">> /var/log/ncftpspooler.log\")\nor exit(1);\nprint LOG \"DOWNLOAD\" if ($params{\"op\"} eq \"get\");\nprint LOG \"UPLOAD\" if ($params{\"op\"} eq \"put\");\nprint LOG \" \", $params{\"local-file\"}, \"\\n\";\nclose(LOG);\n}\n",
                "subsections": []
            },
            "DIAGNOSTICS": {
                "content": "The log file should be examined to determine if any ncftpspooler processes are actively work‐\ning on jobs.  The log contains copious amounts of useful information,  including  the  entire\nFTP control connection conversation between the FTP client and server.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "The  recursive  option  may not be reliable since ncftpspooler depends on functionality which\nmay or may not be present in the remote server software.  Additionally, even if the function‐\nality  is  available, ncftpspooler may need to use heuristics which cannot be considered 100%\naccurate.  Therefore it is best to create individual jobs for  each  file  in  the  directory\ntree, rather than a single recursive directory job.\n\nFor  resumption  of  downloads  to work, the remote server must support the FTP SIZE and MDTM\nprimitives.  Most modern FTP server software can do this, but there are  still  a  number  of\nbare-bones  ftpd implementations which do not.  In these cases, ncftpspooler will re-download\nthe file in entirety each time until the download succeeds.\n\nThe program needs to be improved to detect jobs that have no chance of ever  completing  suc‐\ncessfully.  There are still a number of cases where jobs can get spooled but get retried over\nand over again until a vigilant sysadmin manually removes the jobs.\n\nThe spool files may contain usernames and passwords stored in cleartext.  These files  should\nnot be readable by any user except the user running the program!\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Mike Gleason, NcFTP Software (http://www.ncftp.com).\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "ncftpbatch(1), ncftp(1), ncftpput(1), ncftpget(1), uucp(1).\n\n\n\nncftpspooler                               NcFTP Software                            ncftpspooler(1)",
                "subsections": []
            }
        }
    }
}