Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Nounous
scripts
Commits
0b22dda0
Commit
0b22dda0
authored
Jun 04, 2013
by
Daniel STAN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[logrotate|logall] copie vers le nfs silencieuse
Car logrotate forwardait le stdout même si lancé par un cron.
parent
d885233c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
firewall/firewall-logrotate-script.sh
firewall/firewall-logrotate-script.sh
+8
-0
No files found.
firewall/firewall-logrotate-script.sh
View file @
0b22dda0
#!/bin/bash
#
# Script de sauvegarde régulière des logs firewall vers le nfs
#
# Reste silencieux en cas de succès si la variable d'env $QUIET est non vide
umask
0177
...
...
@@ -15,6 +19,7 @@ if [ ! -d "$logs_dst" ]; then
exit
42
fi
# tant qu'il existe un fichier, le sauvegarder (<!>)
while
(
ls
-tr
"
$logs_src
"
|
grep
-E
'logall\.log\.[0-9]+\..z2?'
)
;
do
dernier_fichier
=
$logs_src
/
$(
ls
-tr
"
$logs_src
"
|
grep
-E
'logall\.log\.[0-9]+\..z2?'
|
head
-1
)
...
...
@@ -27,9 +32,12 @@ M=$(date -d "01-$M-01" +%m)
D
=
$(
bzcat
"
$dernier_fichier
"
|
head
-1
|
awk
'{print $2}'
)
D
=
$(
date
-d
"01-01-
$D
"
+%d
)
date
=
$Y
-
$M
-
$D
[
-n
"
$QUIET
"
]
||
{
echo install
-o
root
-g
root
-m
400
"
$dernier_fichier
"
"
$logs_dst
/logall.log.
$date
.bz2"
echo rm
"
$dernier_fichier
"
}
install
-o
root
-g
root
-m
400
"
$dernier_fichier
"
"
$logs_dst
/logall.log.
$date
.bz2"
rm
"
$dernier_fichier
"
done
# Fin de boucle </!>
find
"
$logs_dst
"
-mtime
+365
-delete
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment