Skip to content

Commit

Permalink
added timestamp to backup file
Browse files Browse the repository at this point in the history
  • Loading branch information
ens-ftricomi committed Aug 12, 2024
1 parent c7dc0bc commit 6e3fbd4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pipelines/nextflow/workflows/short_read.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ nextflow.enable.dsl=2

import java.nio.file.*
import java.nio.file.attribute.BasicFileAttributes
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

// Show help message
params.help = false
Expand Down Expand Up @@ -121,16 +123,20 @@ workflow.onComplete {
def outDir = Paths.get(params.outDir)

Files.newDirectoryStream(outDir, "*").each { path ->
deleteRecursively(path)
if (!path.toString().endsWith(".gz")) {
deleteRecursively(path)
}
}

log.info "Cleaning process completed successfully."
} catch (Exception e) {
log.error "Exception occurred while executing cleaning command: ${e.message}", e
}
}
if (params.backupDB) {
def backupFilePath = "${params.outDir}/${params.transcriptomic_dbname}_backup.sql"
//def backupFilePath = "${params.outDir}/${params.transcriptomic_dbname}_backup.sql"
// Generate a timestamp
def timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss"))
def backupFilePath = "${params.outDir}/${params.transcriptomic_dbname}_backup_${timestamp}.sql"
def gzipFilePath = "${backupFilePath}.gz"

// Define the database backup command as a list of arguments
Expand Down

0 comments on commit 6e3fbd4

Please sign in to comment.