FTP transfer script

  • In another threat I promised to submit a script for transferring files via FTP, here it comes. I use it at work for transferring files to customers and I have about ten of them running each night. It can be easily adapted for SFTP transfers.
    There is no email messaging included because I have a control job running each morning which collects error logs (Written in VB) and sent an email to my account.


    What does it?
    Once configured and called by a cronjob by putting it into a cron. - directory (Don't forget to set chmod 0755 and chown root:root if you want to call it by cron) or included in the crontab of an user it looks into the specified local directory, counts the files and loops until all files are transferred. It opens a connection for each file, queries the transfer status and if successful it deletes the file. All actions are logged.


    Prerequisites: This script uses ncftpput, a part of the ncftp-suite. You have to install ncftp with the command apt-get install ncftp


    ./edit: Found an error, while cleaning the script and commenting the actions I have moved the date part to a wrong position. It has to be called before the logfiles are generated, otherwise the date variable has no content and the logfile will be created without a date stamp.


    Homebox: Bitfenix Prodigy Case, ASUS E45M1-I DELUXE ITX, 8GB RAM, 5x 4TB HGST Raid-5 Data, 1x 320GB 2,5" WD Bootdrive via eSATA from the backside
    Companybox 1: Standard Midi-Tower, Intel S3420 MoBo, Xeon 3450 CPU, 16GB RAM, 5x 2TB Seagate Data, 1x 80GB Samsung Bootdrive - testing for iSCSI to ESXi-Hosts
    Companybox 2: 19" Rackservercase 4HE, Intel S975XBX2 MoBo, C2D@2200MHz, 8GB RAM, HP P212 Raidcontroller, 4x 1TB WD Raid-0 Data, 80GB Samsung Bootdrive, Intel 1000Pro DualPort (Bonded in a VLAN) - Temp-NFS-storage for ESXi-Hosts

    Einmal editiert, zuletzt von datadigger ()

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!