hostname to archive
This commit is contained in:
+7
-8
@@ -78,6 +78,13 @@ if [ "$files" == "" ]
|
|||||||
then
|
then
|
||||||
echo "No files found older than ${Oldest} in ${LogDir}"
|
echo "No files found older than ${Oldest} in ${LogDir}"
|
||||||
else
|
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"
|
TarFile="${LogArchiveDir}/${tmsig}.logs.tgz"
|
||||||
if [ "${AddHostname}" == "Y" ] ; then
|
if [ "${AddHostname}" == "Y" ] ; then
|
||||||
TarFile="${LogArchiveDir}/${tmsig}.$(hostname -s).logs.tgz"
|
TarFile="${LogArchiveDir}/${tmsig}.$(hostname -s).logs.tgz"
|
||||||
@@ -86,14 +93,6 @@ else
|
|||||||
echo -----------------
|
echo -----------------
|
||||||
echo ${files}
|
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}"
|
Cmd="tar zcvf ${TarFile} ${files}"
|
||||||
echo $Cmd
|
echo $Cmd
|
||||||
eval $Cmd
|
eval $Cmd
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
# ---------- pruning md_archive
|
||||||
|
10 3 * * * /works/utils/prune_data.sh -d /works/cvtt/md_archive -D '6 months ago' 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' >> /works/logs/$(date '+\%Y\%m\%d').prune_md_archive.log
|
||||||
|
#
|
||||||
|
# ---------- U t i l s
|
||||||
|
15 0 * * * /works/utils/archive_logs.sh -L /works/logs -A /works/archive/logs -D 'week ago' -H 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' >> /works/logs/$(date +\%Y\%m\%d).archive_logs.log
|
||||||
|
#
|
||||||
|
|
||||||
Reference in New Issue
Block a user