Fix final timestamp format

This commit is contained in:
2026-01-29 23:26:58 +08:00
parent f79b652cb9
commit 1da632083a

View File

@@ -292,7 +292,7 @@ class FileBackup(BackupStrategy):
self.log("Memulai Backup File: {} -> {}".format(source, target_dest))
name = os.path.basename(source.rstrip(os.sep))
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H")
if archive:
# ZIP MODE
@@ -423,11 +423,11 @@ class MySQLBackup(BackupStrategy):
# Determine backup mode
if all_databases:
self.log("Menghubungkan ke MySQL: {}:{} (SEMUA DATABASE)".format(host, port))
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H")
dump_file_path = os.path.join(target_dest, "all_databases_{}.sql".format(timestamp))
else:
self.log("Menghubungkan ke MySQL: {}:{} / {}".format(host, port, database))
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H")
dump_file_path = os.path.join(target_dest, "{}_{}.sql".format(database, timestamp))
# Get skip_ssl setting (default True for backward compatibility)
@@ -578,7 +578,7 @@ class PostgresBackup(BackupStrategy):
self.log("Menggunakan pg_dumpall: {}".format(pg_tool_path))
self.log("Menghubungkan ke Postgres: {}:{} (SEMUA DATABASE)".format(host, port))
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H")
dump_file_path = os.path.join(target_dest, "all_databases_{}.sql".format(timestamp))
else:
# Use pg_dump for single database
@@ -592,7 +592,7 @@ class PostgresBackup(BackupStrategy):
self.log("Menggunakan pg_dump: {}".format(pg_tool_path))
self.log("Menghubungkan ke Postgres: {}:{} / {}".format(host, port, database))
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H")
dump_file_path = os.path.join(target_dest, "{}_{}.sql".format(database, timestamp))
# Prepare Environment for Password