hostname to archive

This commit is contained in:
Oleg Sheynin
2026-06-22 18:13:58 +00:00
parent 7efef6b768
commit 620c5757b3
2 changed files with 15 additions and 8 deletions
+7 -8
View File
@@ -78,6 +78,13 @@ if [ "$files" == "" ]
then
echo "No files found older than ${Oldest} in ${LogDir}"
else
oldest_file=$(ls -t ${files} | tail -1)
youngest_file=$(ls -tr ${files} | tail -1)
tstmp1=$(stat --printf '%y' ${oldest_file})
tstmp2=$(stat --printf '%y' ${youngest_file})
tmsig="$(date -d "${tstmp1}" +"%Y%m%d_%H%M%S")-$(date -d "${tstmp2}" +"%Y%m%d_%H%M%S")"
TarFile="${LogArchiveDir}/${tmsig}.logs.tgz"
if [ "${AddHostname}" == "Y" ] ; then
TarFile="${LogArchiveDir}/${tmsig}.$(hostname -s).logs.tgz"
@@ -86,14 +93,6 @@ else
echo -----------------
echo ${files}
oldest_file=$(ls -t ${files} | tail -1)
youngest_file=$(ls -tr ${files} | tail -1)
tstmp1=$(stat --printf '%y' ${oldest_file})
tstmp2=$(stat --printf '%y' ${youngest_file})
tmsig="$(date -d "${tstmp1}" +"%Y%m%d_%H%M%S")-$(date -d "${tstmp2}" +"%Y%m%d_%H%M%S")"
echo $tmsig
Cmd="tar zcvf ${TarFile} ${files}"
echo $Cmd
eval $Cmd