Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
eole-wol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
primtux-eole
Plan de cuques
eole-wol
Commits
07e165f2
Verified
Commit
07e165f2
authored
6 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
Clean in a crontab
parent
8f5b3a1a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
postinstall_partage.sh
+6
-0
6 additions, 0 deletions
postinstall_partage.sh
registry/scripts/clean.sh
+28
-0
28 additions, 0 deletions
registry/scripts/clean.sh
registry/scripts/registry.sh
+2
-8
2 additions, 8 deletions
registry/scripts/registry.sh
with
36 additions
and
8 deletions
postinstall_partage.sh
+
6
−
0
View file @
07e165f2
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
DIR
=
$(
dirname
$0
)
cd
/opt
cd
/opt
apt-get update
apt-get update
...
@@ -34,3 +36,7 @@ do
...
@@ -34,3 +36,7 @@ do
systemctl
enable
$service
systemctl
enable
$service
done
done
# Add registry clean to cronab
line
=
"0 1 1 * *
$DIR
/registry/scripts/clean.sh > /dev/null 2>&1"
(
crontab
-l
;
echo
"
${
line
}
"
)
| crontab -
This diff is collapsed.
Click to expand it.
registry/scripts/clean.sh
0 → 100755
+
28
−
0
View file @
07e165f2
#!/bin/bash
# Copyright (C) 2018 Tetras Libre <Contact@Tetras-Libre.fr>
# Author: Beniamine, David <David.Beniamine@Tetras-Libre.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
conf_dir
=
"/etc/registry"
conf_file
=
"
$conf_dir
/hosts"
while
read
line
do
if
[
"
$(
echo
$line
|
cut
-d
' '
-f
1
)
"
-gt
"
$(
date
-d
'-6 month'
+%Y%m%d
)
"
]
then
LINES
=
"
$LINES
\n
$(
date
+%Y%m%d
)
$(
echo
$line
|
cut
-d
' '
-f
2-
)
"
fi
done
<
$conf_file
echo
-e
$LINES
>
$conf_file
This diff is collapsed.
Click to expand it.
registry/scripts/registry.sh
+
2
−
8
View file @
07e165f2
...
@@ -25,6 +25,7 @@ IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
...
@@ -25,6 +25,7 @@ IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
port
=
9998
port
=
9998
conf_dir
=
"/etc/registry"
conf_dir
=
"/etc/registry"
conf_file
=
"
$conf_dir
/hosts"
conf_file
=
"
$conf_dir
/hosts"
DIR
=
$(
dirname
$0
)
if
[
!
-d
$conf_dir
]
if
[
!
-d
$conf_dir
]
then
then
...
@@ -33,14 +34,7 @@ then
...
@@ -33,14 +34,7 @@ then
ssh-keygen
-P
""
-f
/root/.ssh/id_rsa
ssh-keygen
-P
""
-f
/root/.ssh/id_rsa
else
else
# Clean
# Clean
while
read
line
$DIR
/clean.sh
do
if
[
"
$(
echo
$line
|
cut
-d
' '
-f
1
)
"
-gt
"
$(
date
-d
'-6 month'
+%Y%m%d
)
"
]
then
LINES
=
"
$LINES
\n
$(
date
+%Y%m%d
)
$(
echo
$line
|
cut
-d
' '
-f
2-
)
"
fi
done
<
$conf_file
echo
-e
$LINES
>
$conf_file
fi
fi
while
true
while
true
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment