LFTP - Deploy an application in command line
Installation
First, we need to install lftp on our system:
# On Debian / Ubuntusudo apt install lftp
# On Fedorayum install lftp
# On Alpineapk add lftp
Use lftp
Here, we define 3 variables:
$(FTP_USERNAME)
represents the FTP username ; example:alex
$(FTP_PASSWORD)
represents the FTP password ; example:SuperSpiciesMeltingMountains67
$(FTP_HOSTNAME)
represents the FTP host ; example:ftp://alexandre@ftp.cluster473.hosting.domain.net
lftp -u $(FTP_USERNAME),$(FTP_PASSWORD) -e "mirror --ignore-time --reverse --parallel --verbose --delete -R ./ www/; quit" $(FTP_HOSTNAME)
This line uses lftp
to connect to the ftp server.
The command mirror
is used to synchronize local files and server files together. Here we sync the local ./
directory with the www/
FTP directory.
Manual
If you need more informations, here are the available flags from the manual:
-c, --continue Continue a mirror job if possible-e, --delete Delete files not present at remote site --delete-first Delete old files before transferring new ones --depth-first Descend into subdirectories before transferring files-s, --allow-suid Set suid/sgid bits according to remote site --allow-chown Try to set owner and group on files --ascii Use ascii mode transfers (implies --ignore-size) --ignore-time Ignore time when deciding whether to download --ignore-size Ignore size when deciding whether to download --only-missing Download only missing files --only-existing Download only files already existing at target-n, --only-newer Download only newer files (-c won't work) --no-empty-dirs Don't create empty directories (implies --depth-first)-r, --no-recursion Don't go to subdirectories --no-symlinks Don't create symbolic links-p, --no-perms Don't set file permissions --no-umask Don't apply umask to file modes-R, --reverse Reverse mirror (put files)-L, --dereference Download symbolic links as files-N, --newer-than=SPEC Download only files newer than specified time --on-change=CMD Execute the command if anything has been changed --older-than=SPEC Download only files older than specified time --size-range=RANGE Download only files with size in specified range-P, --parallel[=N] Download N files in parallel --use-pget[-n=N] Use pget to transfer every single file --loop Loop until no changes found-i RX, --include RX include matching files-x RX, --exclude RX exclude matching files-I GP, --include-glob GP include matching files-X GP, --exclude-glob GP exclude matching files-v, --verbose[=level] Verbose operation --log=FILE Write lftp commands being executed to FILE --script=FILE Write lftp commands to FILE, but don't execute them --just-print, --dry-run Same as --script=- --use-cache Use cached directory listings--Remove-source-files Remove files after transfer (use with caution)-a Same as --allow-chown --allow-suid --no-umask
Thank you for reading my post ! I hope it helped !
Understanding XSS vulnerabilities
In this article, we will explore how XSS vulnerabilities work and how to prevent them
Understanding CSRF vulnerabilities
In this article, we will explore how CSRF vulnerabilities work and how to prevent them
Understanding SQL injection vulnerabilities
In this article, we will explore how SQL injection vulnerabilities work and how to prevent them
Practice code with the "Quick Sort" algorithm
Enhance your coding skills by learning how the Quick Sort algorithm works!
The SOLID/STUPID principles
Learn what are the SOLID and STUPID principles with examples
Create a Docker Swarm playground
Let's create Docker Swarm playground on your local machine
Create an Ansible playground with Docker
Let's create an Ansible playground with Docker
HashiCorp Vault - Technological watch
Learn what is HashiCorp Vault in less than 5 minutesĀ !