#!/bin/bash
# Managed by puppet
# This file manages the atop binary files. It will keep binary files for last
# <%= @rotate %> days instead of 30 days provided by atop.
PATH=/sbin:/bin:/usr/sbin:/usr/bin

# remove files older than <%= @rotate %> days
find <%= @logpath %> -type f -name 'atop_*' -mtime +<%= @rotate %> -delete

# remove atop_current if it is a broken symlink
test -L <%= @logpath %>/atop_current -a ! -e <%= logpath %>/atop_current && \
  rm <%= @logpath %>/atop_current

# link current to most recent file if it exists
recent=$(find <%= @logpath %>/atop_* -type f | tail -1)
if [ -n "$recent" ]; then
  ln -f -s "$recent" <%= @logpath %>/atop_current
fi

#!/bin/bash
# Managed by puppet
# This file manages the atop binary files. It will keep binary files for last
# <%= @rotate %> days instead of 30 days provided by atop.
PATH=/sbin:/bin:/usr/sbin:/usr/bin

# remove files older than <%= @rotate %> days
find <%= @logpath %> -type f -name 'atop_*' -mtime +<%= @rotate %> -delete

# remove atop_current if it is a broken symlink
test -L <%= @logpath %>/atop_current -a ! -e <%= @logpath %>/atop_current && \
  rm <%= @logpath %>/atop_current

# link current to most recent file if it exists
recent=$(find <%= @logpath %>/atop_* -type f | tail -1)
if [ -n "$recent" ]; then
  ln -f -s "$recent" <%= @logpath %>/atop_current
fi

Fix depricated variable call in template
Fix depricated variable call in template

It may fire an error in future versions

Change-Id: Icc059375ce1887029dadb4c3072bd13976bf2b8b
Closes-bug: #1554477
