Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- PROTOCOL="ftp"
- URL="server.example.com"
- LOCALDIR="/home/user/downloads"
- REMOTEDIR="dir/remote/server/"
- USER="user"
- PASS="password"
- REGEX="*.txt"
- LOG="/home/user/script.log"
- cd $LOCALDIR
- if [ $? -dt 0 ]; then
- echo "$(date "+%d/%m/%Y-%T") Cant cd to $LOCALDIR. Please make sure this local directory is valid" >> $LOG
- fi
- lftp $PROTOCOL://$URL <<- DOWNLOAD
- user $USER "$PASS"
- cd $REMOTEDIR
- mget -E $REGEX
- DOWNLOAD
- if [ $? -dt 0 ]; then
- echo "$(date "+%d/%m/%Y-%T") Cant download files. Make sure the credentials and server information are correct" >> $LOG
- fi
- 45,30,15,00 * * * * /home/user/downloader.sh >/dev/null 2>&1
- */15 * * * * /home/user/downloader.sh >/dev/null 2>&1
- if [ $? -dt 0 ]; then
- fi
- lftp $PROTOCOL://$URL <<- DOWNLOAD
- DOWNLOAD
- user $USER "$PASS"
- cd $REMOTEDIR
- mget -E $REGEX
- [root@host ~]# lftp
- lftp :~> ?
- !<shell-command> (commands) alias [<name> [<value>]]
- attach [PID] bookmark [SUBCMD] cache [SUBCMD]
- cat [-b] <files> cd <rdir> chmod [OPTS] mode file...
- close [-a] [re]cls [opts] [path/][pattern] debug [<level>|off] [-o <file>]
- du [options] <dirs> exit [<code>|bg] get [OPTS] <rfile> [-o <lfile>]
- glob [OPTS] <cmd> <args> help [<cmd>] history -w file|-r file|-c|-l [cnt]
- jobs [-v] [<job_no...>] kill all|<job_no> lcd <ldir>
- lftp [OPTS] <site> ln [-s] <file1> <file2> ls [<args>]
- mget [OPTS] <files> mirror [OPTS] [remote [local]] mkdir [-p] <dirs>
- module name [args] more <files> mput [OPTS] <files>
- mrm <files> mv <file1> <file2> [re]nlist [<args>]
- open [OPTS] <site> pget [OPTS] <rfile> [-o <lfile>] put [OPTS] <lfile> [-o <rfile>]
- pwd [-p] queue [OPTS] [<cmd>] quote <cmd>
- repeat [OPTS] [delay] [command] rm [-r] [-f] <files> rmdir [-f] <dirs>
- scache [<session_no>] set [OPT] [<var> [<val>]] site <site-cmd>
- source <file> torrent [-O <dir>] <file|URL>... user <user|URL> [<pass>]
- wait [<jobno>] zcat <files> zmore <files>
- lftp :~> ? mget
- Usage: mget [OPTS] <files>
- Gets selected files with expanded wildcards
- -c continue, resume transfer
- -d create directories the same as in file names and get the
- files into them instead of current directory
- -E delete remote files after successful transfer
- -a use ascii mode (binary is the default)
- -O <base> specifies base directory or URL where files should be placed
Add Comment
Please, Sign In to add comment