Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Dec 1, 2019
1 parent 76f8d0d commit 6c83e32
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cookbooks/clean-up/attributes/default.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -e

export CLEAN_UP_OLD_LOG_FOLDER_PATHS=(
'/var/log'
)
7 changes: 6 additions & 1 deletion cookbooks/clean-up/recipes/install-delete-old-logs.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ function install()
{
umask '0022'

cp -f "$(dirname "${BASH_SOURCE[0]}")/../files/delete-old-logs" '/etc/cron.hourly'
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/delete-old-logs.bash" \
'/etc/cron.hourly/delete-old-logs' \
'__LOG_FOLDER_PATHS__' "$(arrayToParameters "${CLEAN_UP_OLD_LOG_FOLDER_PATHS[@]}")"

chmod 755 '/etc/cron.hourly/delete-old-logs'
cat '/etc/cron.hourly/delete-old-logs'
echo
Expand All @@ -15,6 +19,7 @@ function install()
function main()
{
source "$(dirname "${BASH_SOURCE[0]}")/../../../libraries/util.bash"
source "$(dirname "${BASH_SOURCE[0]}")/../attributes/default.bash"

header 'INSTALLING DELETE-OLD-LOGS'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ function main()
done
}

main "${@}"
main __LOG_FOLDER_PATHS__
7 changes: 7 additions & 0 deletions libraries/util.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
# ARRAY UTILITIES #
###################

function arrayToParameters()
{
local -r array=("${@}")

printf "'%s' " "${array[@]}"
}

function arrayToString()
{
local -r array=("${@}")
Expand Down

0 comments on commit 6c83e32

Please sign in to comment.