init
This commit is contained in:
commit
ddbf1d2555
7
README
Normal file
7
README
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
script for Evolix maintenance
|
||||||
|
=============================
|
||||||
|
|
||||||
|
script evomaintenance.sh which sends a mail
|
||||||
|
for each intervention on a Pack Evolix server.
|
||||||
|
|
||||||
|
* Pb quand '&' dans le msg d'evomaintenance...
|
5
changelog
Normal file
5
changelog
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
0.2.7 : Correction d'un bug lors de l'utilisation de '&' dans le texte
|
||||||
|
0.2.6 : Precision du charset dans les entetes du mail
|
||||||
|
0.2.5 : Correction d'un bug avec le path de sendmail sous OpenBSD
|
||||||
|
0.2.4 : Correction d'un bug lors de l'utilisation de '/' dans le texte
|
||||||
|
0.2.3 : Correction d'un bug avec $REALM
|
47
debian/changelog
vendored
Normal file
47
debian/changelog
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
evomaintenance (0.2.7-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* New upstream release.
|
||||||
|
* This version fixes bug when text contains a character '&'.
|
||||||
|
|
||||||
|
-- Gregory Colpart <reg@debian.org> Thu, 11 Mar 2010 16:14:19 +0100
|
||||||
|
|
||||||
|
evomaintenance (0.2.6-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* New upstream release.
|
||||||
|
* This version fixes the bug for charset in mail.
|
||||||
|
* Add Build-Depends on debhelper.
|
||||||
|
|
||||||
|
-- Gregory Colpart <reg@debian.org> Mon, 01 Jun 2009 15:57:32 +0200
|
||||||
|
|
||||||
|
evomaintenance (0.2.4-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* New upstream release.
|
||||||
|
* This version fixes annoying bug when text contains a character '/'.
|
||||||
|
|
||||||
|
-- Gregory Colpart <reg@debian.org> Wed, 26 Nov 2008 01:03:26 +0100
|
||||||
|
|
||||||
|
evomaintenance (0.2.3-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* New upstream release.
|
||||||
|
* This version corrects a bug with $REALM var.
|
||||||
|
|
||||||
|
-- Gregory Colpart <reg@debian.org> Mon, 10 Nov 2008 01:37:06 +0100
|
||||||
|
|
||||||
|
evomaintenance (0.2.2-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* New upstream release.
|
||||||
|
* Fix debian/rules to have correct permissions.
|
||||||
|
|
||||||
|
-- Gregory Colpart <reg@debian.org> Mon, 10 Nov 2008 00:09:39 +0100
|
||||||
|
|
||||||
|
evomaintenance (0.2.1-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* New upstream release.
|
||||||
|
|
||||||
|
-- Gregory Colpart <reg@debian.org> Sun, 9 Nov 2008 22:37:20 +0100
|
||||||
|
|
||||||
|
evomaintenance (0.2-1) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* Initial release.
|
||||||
|
|
||||||
|
-- Gregory Colpart <reg@debian.org> Sun, 9 Nov 2008 19:53:16 +0100
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
5
|
14
debian/control
vendored
Normal file
14
debian/control
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Source: evomaintenance
|
||||||
|
Section: misc
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Gregory Colpart <reg@debian.org>
|
||||||
|
Build-Depends: debhelper (>= 5)
|
||||||
|
Standards-Version: 3.8.0
|
||||||
|
|
||||||
|
Package: evomaintenance
|
||||||
|
Architecture: all
|
||||||
|
Depends: postgresql-client, sudo
|
||||||
|
Description: script for Evolix maintenance
|
||||||
|
This package contains the script evomaintenance.sh
|
||||||
|
which sends a mail for each intervention on a Pack Evolix server.
|
||||||
|
|
1
debian/copyright
vendored
Normal file
1
debian/copyright
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
It's a "private" package, then no real copyright for now...
|
45
debian/rules
vendored
Executable file
45
debian/rules
vendored
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/make -f
|
||||||
|
# -*- makefile -*-
|
||||||
|
# Sample debian/rules that uses debhelper.
|
||||||
|
# This file was originally written by Joey Hess and Craig Small.
|
||||||
|
# As a special exception, when this file is copied by dh-make into a
|
||||||
|
# dh-make output file, you may use that output file without restriction.
|
||||||
|
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||||
|
# Uncomment this to turn on verbose mode.
|
||||||
|
#export DH_VERBOSE=1
|
||||||
|
|
||||||
|
build: build-stamp
|
||||||
|
build-stamp:
|
||||||
|
dh_testdir
|
||||||
|
touch $@
|
||||||
|
clean:
|
||||||
|
dh_testdir
|
||||||
|
dh_testroot
|
||||||
|
rm -f build-stamp
|
||||||
|
dh_clean
|
||||||
|
install: build
|
||||||
|
dh_testdir
|
||||||
|
dh_testroot
|
||||||
|
dh_clean -k
|
||||||
|
dh_installdirs
|
||||||
|
install -m 700 -d $(CURDIR)/debian/evomaintenance/usr/share/scripts
|
||||||
|
install -m 700 evomaintenance.sh $(CURDIR)/debian/evomaintenance/usr/share/scripts/
|
||||||
|
install -m 600 evomaintenance.tpl $(CURDIR)/debian/evomaintenance/usr/share/scripts/
|
||||||
|
install -m 755 -d $(CURDIR)/debian/evomaintenance/etc
|
||||||
|
install -m 600 evomaintenance.cf $(CURDIR)/debian/evomaintenance/etc/
|
||||||
|
# Build architecture-independent files here.
|
||||||
|
binary-arch: build install
|
||||||
|
# We have nothing to do by default.
|
||||||
|
# Build architecture-dependent files here.
|
||||||
|
binary-indep: build install
|
||||||
|
dh_testdir
|
||||||
|
dh_testroot
|
||||||
|
dh_installchangelogs changelog
|
||||||
|
dh_compress
|
||||||
|
dh_installdeb
|
||||||
|
dh_shlibdeps
|
||||||
|
dh_gencontrol
|
||||||
|
dh_md5sums
|
||||||
|
dh_builddeb
|
||||||
|
binary: binary-indep binary-arch
|
||||||
|
.PHONY: build clean binary-indep binary-arch binary install configure
|
15
evomaintenance.cf
Normal file
15
evomaintenance.cf
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Configuration for evomaintenance
|
||||||
|
|
||||||
|
#HOSTNAME=your-host
|
||||||
|
#EVOMAINTMAIL=evomaintenance-your-host@example.com
|
||||||
|
|
||||||
|
export PGPASSWORD=your-passwd
|
||||||
|
|
||||||
|
PGDB=your-db
|
||||||
|
PGTABLE=your-table
|
||||||
|
PGHOST=your-pg-host
|
||||||
|
FROM=jdoe@example.com
|
||||||
|
FULLFROM="John Doe <jdoe@example.com>"
|
||||||
|
URGENCYFROM=mama.doe@example.com
|
||||||
|
URGENCYTEL="06.00.00.00.00"
|
||||||
|
REALM=example.com
|
55
evomaintenance.sh
Normal file
55
evomaintenance.sh
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# EvoMaintenance script
|
||||||
|
# install packages postgresql-client and sudo (Debian)
|
||||||
|
# or port postgresql-client (*BSD)
|
||||||
|
|
||||||
|
# version 0.2
|
||||||
|
# Copyright 2007-2008 Gregory Colpart <reg@evolix.fr>, Evolix <info@evolix.fr>
|
||||||
|
|
||||||
|
test -f /etc/evomaintenance.cf && . /etc/evomaintenance.cf
|
||||||
|
|
||||||
|
[ $HOSTNAME ] || HOSTNAME=`hostname`
|
||||||
|
[ $EVOMAINTMAIL ] || EVOMAINTMAIL=evomaintenance-$(echo $HOSTNAME | cut -d- -f1)@$REALM
|
||||||
|
|
||||||
|
# get ipaddress
|
||||||
|
IP=`LC_ALL=C who -m | grep $SUDO_USER | head -1 | tr -s ' ' | cut -d" " -f6 | sed -e "s/^(// ; s/)$//"`
|
||||||
|
|
||||||
|
# get begin_date
|
||||||
|
BEGIN_YEAR=`date "+%Y"`
|
||||||
|
BEGIN_DATE=`LC_ALL=C who -m | grep $SUDO_USER | head -1 | tr -s ' ' | cut -d" " -f3,4,5`
|
||||||
|
|
||||||
|
# end_date
|
||||||
|
#now()
|
||||||
|
|
||||||
|
# details
|
||||||
|
echo "Please, enter details about your maintenance"
|
||||||
|
read TEXTE
|
||||||
|
|
||||||
|
if [ "$TEXTE" = "" ]; then
|
||||||
|
echo "no value..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# SQL
|
||||||
|
TEXTE=`echo "$TEXTE" | sed "s/'/\\\\\\'/g ; s@/@\\\\\/@g ; s@\\&@et@g"`
|
||||||
|
|
||||||
|
# recapitulatif
|
||||||
|
echo "hostname = $HOSTNAME"
|
||||||
|
echo "user = $SUDO_USER"
|
||||||
|
echo "IP = $IP"
|
||||||
|
echo "begin date = $BEGIN_YEAR $BEGIN_DATE"
|
||||||
|
echo "details = $TEXTE"
|
||||||
|
|
||||||
|
echo "To cancel, [Ctrl+C] else press [Enter]"
|
||||||
|
read enter
|
||||||
|
|
||||||
|
echo "
|
||||||
|
INSERT INTO evomaint(hostname,userid,ipaddress,begin_date,end_date,details)
|
||||||
|
VALUES ('$HOSTNAME','$SUDO_USER','$IP','$BEGIN_YEAR $BEGIN_DATE',now(),'$TEXTE') " | \
|
||||||
|
psql $PGDB $PGTABLE -h $PGHOST
|
||||||
|
|
||||||
|
cat /usr/share/scripts/evomaintenance.tpl | \
|
||||||
|
sed -e "s/__TO__/$EVOMAINTMAIL/ ; s/__HOSTNAME__/$HOSTNAME/ ; s/__USER__/$SUDO_USER/ ; s/__BEGIN_DATE__/$BEGIN_YEAR $BEGIN_DATE/ ; s/__TEXTE__/$TEXTE/ ; s/__IP__/$IP/ ; s/__FULLFROM__/$FULLFROM/ ; s/__FROM__/$FROM/ ; s/__URGENCYFROM__/$URGENCYFROM/ ; s/__URGENCYTEL__/$URGENCYTEL/"| \
|
||||||
|
sendmail -oi -t -f $FROM
|
||||||
|
|
27
evomaintenance.tpl
Normal file
27
evomaintenance.tpl
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
From: __FULLFROM__
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
To: __TO__
|
||||||
|
Subject: [evomaintenance] Intervention sur __HOSTNAME__ (__USER__)
|
||||||
|
|
||||||
|
Bonjour,
|
||||||
|
|
||||||
|
Une intervention vient de se terminer sur votre serveur.
|
||||||
|
Voici les renseignements sur l'intervention :
|
||||||
|
|
||||||
|
Nom du serveur : __HOSTNAME__
|
||||||
|
Personne ayant réalisée l'intervention : __USER__
|
||||||
|
Intervention réalisée depuis : __IP__
|
||||||
|
Date/heure du début de l'intervention : __BEGIN_DATE__
|
||||||
|
Renseignements sur l'intervention :
|
||||||
|
__TEXTE__
|
||||||
|
|
||||||
|
Pour réagir à cette intervention, vous pouvez répondre à ce message
|
||||||
|
(sur l'adresse mail __FROM__). En cas d'urgence, utilisez
|
||||||
|
l'adresse __URGENCYFROM__ ou notre téléphone portable d'astreinte
|
||||||
|
(__URGENCYTEL__)
|
||||||
|
|
||||||
|
Cordialement,
|
||||||
|
--
|
||||||
|
__FULLFROM__
|
Loading…
Reference in a new issue