hostname to archive
This commit is contained in:
+7
-8
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user