upload files to remote systems
This module uploads files from the local machine to the remote machine.
Files are verified with md5 checksums before transfer and files that are already present and intact on the remote machine are not recopied.
Use the download module to gather files from remote filesystem to the local machine.
(upload options)
options
A hashmap of options. All available option keys and their values are described below
Option | Description |
---|---|
:src type string | A path to a file or directory on the local machine that you want to copy to the remote machine. If this option is specified then If this path is a directory the |
:content type string bytearray file | Some content to upload to a file. Can be a If this option is specified then |
:dest type string | The destination path to copy the file or directory into. If :recurse is true and :dest path ends in a slash; indicates that destination is a directory and the contents of :src are to be copied into the directory. If :recurse is true and :dest path does not end in a slash; indicates that the :src directory is to be copies as the specified path. |
:owner type integer string | Make the destination file or files owned by this user. Can be specified as a username or as a uid. |
:group type integer string | Make the destination file or files owned by this group. Can be specified as a group name or as a gid. |
:mode type integer string | Set the access mode of this file or files. Can be specified as an octal value of the form 0xxx, as a decimal value, or as a change string as is accepted by the system chmod command (eg. "u+rwx"). |
:attrs type string | Set the file or files special attributes. Provide as a string that is accepted to the chattr shell command |
:dir-mode type integer string | When doing a recursive copy, set the access mode of directories to this mode. Can be specified as an octal value of the form 0xxx, as a decimal value, or as a change string as is accepted by the system chmod command (eg. "u+rwx"). |
:preserve type boolean | Preserve the access mode and file timestamps of the original source file. |
:recurse type boolean | Perform a recursive copy to transfer the entire directory contents |
:force type boolean | Force the copy operation to overwrite other content. If the destination path already exists as a file, and the upload is to recursively copy a directory, delete the destination file before copying the directory. |
(upload {:src "./project.clj"
:dest "/tmp/project.clj"
:owner "john"
:group "users"
:mode 0755
:dir-mode 0644})
(upload {:src "../"
:dest "/tmp/folder-path"
:recurse true
:preserve true})
(upload {:content (clojure.java.io/file "/usr/local/bin/spire")
:dest "/usr/local/bin/"
:mode "a+x"})
(upload {:content (selmer "nginx.conf" (edn "webserver.edn"))
:dest "/etc/nginx/nginx.conf"})
(upload {:content (byte-array [0x01 0x02 0x03 0x04])
:dest "small.bin"})