Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
server-utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NoCloud
server-utils
Commits
c4ec24de
Unverified
Commit
c4ec24de
authored
8 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
some documentation
parent
610e1626
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Readme.md
+24
-0
24 additions, 0 deletions
Readme.md
getip.sh
+40
-0
40 additions, 0 deletions
getip.sh
healthReport.sh
+2
-2
2 additions, 2 deletions
healthReport.sh
with
66 additions
and
2 deletions
Readme.md
0 → 100644
+
24
−
0
View file @
c4ec24de
# Script utils
## Healthreport
## Dependencies
systemd
aptitude
debian-goodies
ufw
cpufreq-utils
lm-sensors
pandoc
The following scripts must be in the same directory
getip.sh
## Install
Add the crontab entry
0 7 * * 1 /path/to/healthReport.sh -m "Weekly health report" 2> /dev/null
This diff is collapsed.
Click to expand it.
getip.sh
0 → 100755
+
40
−
0
View file @
c4ec24de
#!/bin/bash
isIP
()
{
ret
=
1
ip
=
$1
if
[[
$ip
=
~^[0-9]
{
1,3
}
\.
[
0-9]
{
1,3
}
\.
[
0-9]
{
1,3
}
\.
[
0-9]
{
1,3
}
$
]]
then
OIFS
=
$IFS
IFS
=
'.'
ip
=(
$1
)
IFS
=
$OIFS
[[
${
ip
[0]
}
-le
255
&&
${
ip
[1]
}
-le
255
&&
${
ip
[2]
}
-le
255
&&
${
ip
[3]
}
-le
255
]]
ret
=
$?
fi
return
$ret
}
#Parse IP from sfr/orange box
myip
=
$(
curl
$(
/sbin/route |
grep
default | /usr/bin/awk
{
'print $2'
}
)
\
|
grep
"Adresse IP"
-A
1 | /usr/bin/tail
-n
1 |
\
sed
-e
"s/.*>[^0-9]*
\(
[0-9]
\{
1,3
\}\.
[0-9]
\{
1,3
\}\.
[0-9]
\{
1,3
\}\.
[0-9]
\{
1,3
\}\)
[^0-9]*<.*/
\1
/g"
)
if
isIP
$myip
then
echo
"External IP is :
$myip
"
exit
0
fi
#Old bad method using hosts, usable if the first method fail
Hosts
=(
"icanhazip.com"
"ident.me"
"ipecho.net/plain"
\
"whatismyip.akamai.com"
"tnx.nl/ip"
"myip.dnsomatic.com"
\
"ip.appspot.com"
"ip.telize.com"
"curlmyip.com"
"ifconfig.me"
)
for
h
in
${
Hosts
[@]
}
do
myip
=
$(
curl
-s
$h
)
if
isIP
$myip
then
echo
"External IP is :
$myip
"
exit
0
fi
done
This diff is collapsed.
Click to expand it.
healthReport.sh
+
2
−
2
View file @
c4ec24de
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +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/>.
sendername
=
"
Tetras Libre
"
sendername
=
"
root@
`
hostname
`
"
recipient
=
"
$sendername
<admin@tetras-libre.fr>
"
recipient
=
"
root
"
level
=
info
level
=
info
date
=
"
$(
date
+%y%m%d_%H%M
)
"
date
=
"
$(
date
+%y%m%d_%H%M
)
"
archiveFile
=
"HealthReport-
$date
.tar.xz"
archiveFile
=
"HealthReport-
$date
.tar.xz"
...
...
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