letsencrypt::Client method backup (protected)

 <instance of letsencrypt::Client[i]> backup [ -mode mode ] fileName

Defined in /usr/local/ns/tcl/letsencrypt/letsencrypt-procs.tcl

Switches:
-mode (optional, defaults to "rename")
Parameters:
fileName (required)

Testcases:
No testcase defined.
Source code:
set backupFileName ""
if {[file exists $fileName]} {
    #
    # If the base file exists, make a backup based on the
    # content (using a sha256 checksum). Using checksums
    # is independent of timestamps and makes sure to
    # prevent loss of data (e.g. configuration files). If
    # we have already a backup file, there is nothing to
    # do.
    #
    set backupFileName $fileName.[ns_md file -digest sha256 $fileName]
    if {![file exists $backupFileName]} {
        file $mode -force $fileName $backupFileName
        :log "Make backup of $fileName<br>"
    }
} else {
    #
    # No need to make a backup, file does not exist yet
    #
}
return $backupFileName
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: