Récupère les SPAMs contenus dans le dossiers .Junk des comptes d'un serveur mail. Les SPAMs sont appris puis effacés.
1 #!/bin/bash
2 ###############################################################################
3 #
4 # mysa-lear : Donne à apprendre les dossiers ".Junk" des comptes mail d'un serveur
5 #
6 # Remarque :
7 # - Les comptes doivent être de la forme $VBOX_PATH/_domaine_/_user_/
8 #
9 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
10 # Version 1.0
11 #
12 ###############################################################################
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation; either version 2
16 # of the License, or (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not,
25 # - write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 # - See http://www.gnu.org/licenses/gpl.html
28 ###############################################################################
29
30 # Mails
31 MAIL_SUBJECT="spamassassin for $(hostname)"
32 #MAIL_FROM="spamassassin@$(hostname)"
33 MAIL_TO=root
34
35 BOX_PATH=/home/vbox
36 TRASH_PATH=/home/vbox/scenario-paintball.com/trash
37 NB_SPAM=0
38
39 # On parcour les comptes mails
40 for spam in $VBOX_PATH/*/*/.Junk/cur/*; do
41 #echo "$spam"
42 sa-learn --spam "$spam" > /dev/null
43 rm -f $spam
44 NB_SPAM=$[$NB_SPAM+1]
45 done;
46
47 # NB de SPAM dans le dossier trash :
48 NB_SPAM_TRASH=$(ls $TRASH_PATH/cur/| wc -l)
49
50 # Rapport par mail :
51 MAIL_BODY="$NB_SPAM SPAM appri(s) par spamassassin.\n\n$NB_SPAM_TRASH SPAM dans le dossier Trash."
52 #echo -e $MAIL_BODY
53 echo -e $MAIL_BODY | /bin/mail -s "$MAIL_SUBJECT" $MAIL_TO
yum-check permet l'envoi par mail d'un "yum check-update" mis en forme. A appeler dans une tâche cron
1 #!/bin/zsh
2 ###############################################################################
3 #
4 # yum-check : Envoi par mail d'un "yum check-update" mis en forme
5 #
6 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
7 # Version 1.0
8 #
9 # Require : zsh, yum
10 #
11 ###############################################################################
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14 # as published by the Free Software Foundation; either version 2
15 # of the License, or (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not,
24 # - write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 # - See http://www.gnu.org/licenses/gpl.html
27 ###############################################################################
28
29
30 # yum check-update
31 LIST=$(/usr/bin/yum check-update -d0)
32 NB_PCK=$(echo $LIST| wc -l)
33 let NB_PCK--
34
35
36 #### [ Paramètres à modifier ] ####
37 MAIL_ENTETE="[spb-box.scenario-paintball.com]"
38 MAIL_BODY_NONEW="Il n'y a pas de packet a mettre à jour."
39 MAIL_BODY_NEW="Il y a $NB_PCK packet(s) a mettre à jour."
40 MAIL_TITLE_NONEW="$MAIL_ENTETE Pas de nouvelle mise a jour"
41 MAIL_TITLE_NEW="$MAIL_ENTETE $NB_PCK mise(s) a jour"
42 #### [ / Paramètres à modifier ] ####
43
44
45 MAIL_TITLE=$MAIL_TITLE_NONEW
46 MAIL_BODY=$MAIL_BODY_NONEW
47 if [ $NB_PCK -gt 0 ]; then
48 MAIL_TITLE=$MAIL_TITLE_NEW
49 MAIL_BODY="$MAIL_BODY_NEW\n\n$LIST"
50 fi
51
52
53 echo -e $MAIL_BODY | /bin/mail -s "$MAIL_TITLE" root
Ce script permet de créer un site complet sur un serveur (dossiers, logs, stats, base MySQL, etc...). Il nécessite une certaine structure dans la gestion des espaces web. Il nécessite aussi : a2ensite, pwgen et un fichier /root/.my.cnf pour ne pas avoir à rentrer les mot de passe MySQL de l'utilisateur root.
1 #!/bin/bash
2 ###############################################################################
3 #
4 # new_site : Permet de créer un site web sur un serveur
5 #
6 # Requiert :
7 # - a2ensite
8 # - pwgen
9 # - Fichier /root/.my.cnf bien configuré ;-)
10 #
11 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
12 # Version 1.0
13 #
14 ###############################################################################
15 # This program is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License
17 # as published by the Free Software Foundation; either version 2
18 # of the License, or (at your option) any later version.
19 #
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not,
27 # - write to the Free Software
28 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 # - See http://www.gnu.org/licenses/gpl.html
30 ###############################################################################
31
32
33 # Varibles
34 VHOST_MODEL='/etc/httpd/vhost.model.conf' # Chemin vers le modèle pour les vhost
35 VHOST_PATH='/etc/httpd/sites-available' # Chemin vers les fichiers vhost
36
37 AWSTATS_MODEL='/etc/httpd/awstats.model.conf' # Chemin vers le modèle awstats
38 AWSTATS_PATH='/etc/awstats' # Chemin vers les fichiers de conf awstats
39 AWSTATS=1 # Activer Awstats
40 MAIL_ADMIN=root # Mail de l'administrateur
41
42 # Valeurs par défaut
43 DEF_WWW_PATH="/home/llaumgui/public_html" # Chemin par défaut pour les sites
44 DEF_SERVER_ADMIN="spb-box@llaumgui.com" # Valeur par défaut pour ServerAdmin
45
46
47
48
49
50 ##
51 ## Affichage du récapitulatif
52 ##
53 function recap(){
54
55 echo "Récapitulatif"
56 echo "================================"
57 echo -e "\nConfiguration du site"
58 echo "-----------------------------"
59 echo " Adresse du site : http://$WWW_URL"
60 echo " Chemin vers le site : $WWW_PATH"
61 if [ "$PERM" != "" ]; then
62 echo " Permissions données à : $PERM"
63 fi
64
65 echo -e "\nConfiguration d'apache"
66 echo "-----------------------------"
67 echo " ServerAdmin : $SERVER_ADMIN"
68
69 echo -e "\nConfiguration de MySQL"
70 echo "-----------------------------"
71 if [ "$DB_NAME" != "" ]; then
72 echo " Base de données : $DB_NAME"
73 echo " Nom de l'utilisateur : $DB_LOGIN"
74 if [ "$1" = 0 ]; then
75 echo " Mot de passe MySQL : $DB_PASSWD"
76 else
77 echo " Mot de passe MySQL : ********"
78 fi
79 else
80 echo " *** Pas de base de données ***"
81 fi
82
83 echo -e "\nConfiguration d'Awstats"
84 echo "-----------------------------"
85 if [ $AWSTATS = 0 ]; then
86 echo " Stats Awstats : Activé"
87 else
88 echo " Stats Awstats : Désactivé"
89 fi
90 }
91
92
93
94 ##
95 ## Valider la récapitulation
96 ##
97 function recap_valid() {
98
99 echo -n "Est-ce correct ? (o/[n]) "; read CORRECT
100 if [ "$CORRECT" = "" ]; then
101 recap_valid
102 fi
103 if [ "$CORRECT" != "o" -a "$CORRECT" != "O" -a "$CORRECT" != "y" -a "$CORRECT" != "Y" ]; then
104 exit 1
105 fi
106
107 return 0
108 }
109
110
111
112
113
114 ###################################
115 ##
116 ## Définition des paramètres
117 ##
118 ###################################
119
120 ##
121 ## Défini l'url du site :
122 ##
123 function set_url() {
124
125 echo -n "URL principale du site (ex: www.google.fr) ? "; read WWW_URL
126
127 if [ "$WWW_URL" = "" ]; then
128 echo -e "\n\nErreur ! Veuillez renseigner une URL pour le site !";
129 set_url
130 fi
131
132 if [ -f "$VHOST_PATH/$WWW_URL" ]; then
133 echo -e "\n\nErreur ! Le site existe déjà !";
134 set_url
135 fi
136
137 return 0
138 }
139
140
141
142 ##
143 ## Défini le chemin vers le site
144 ## @TODO : Mettre en place la vérification du chemin.
145 function set_path() {
146
147 echo -n "Répertoire du site [$DEF_WWW_PATH/$WWW_URL] ? "; read WWW_PATH
148
149 if [ "$WWW_PATH" = "" ]; then
150 WWW_PATH="$DEF_WWW_PATH/$WWW_URL";
151 fi
152
153 if [ -d "$WWW_PATH" ]; then
154 echo -e "\n\nErreur ! Le site existe déjà !";
155 set_path
156 fi
157
158 echo -n "Donner les permissions sur $WWW_PATH/$WWW_URL/www à l'utilisateur UNIX [] ? "; read PERM
159
160 return 0
161 }
162
163
164
165 ##
166 ## Défini le paramètre ServerAdmin du vhost
167 ##
168 function set_serveradmin() {
169
170 echo -n "ServerAdmin [$DEF_SERVER_ADMIN] ? "; read SERVER_ADMIN
171
172 if [ "$SERVER_ADMIN" = "" ]; then
173 SERVER_ADMIN="$DEF_SERVER_ADMIN";
174 fi
175
176 return 0
177 }
178
179
180
181 ##
182 ## Défini le nom de la base
183 ##
184 function set_db_name() {
185
186 echo -n "Nom de la base de données [] ? "; read DB_NAME
187
188 if [ "$DB_NAME" = "" ]; then
189 return 1
190 fi
191
192 mysqlshow -u root "$DB_NAME" &> /dev/null
193 if [ $? -eq 0 ] ; then
194 echo -e "\n\nLa base de données $DB_NAME existe déjà !";
195 set_db_name
196 fi
197
198 return 0
199 }
200
201
202
203 ##
204 ## Défini du login pour la connection à la base
205 ## @TODO : Mettre en place la vérification de l'user.
206 ##
207 function set_db_login() {
208
209 echo -n "Login pour la connection à la base de données ? "; read DB_LOGIN
210
211 return 0
212 }
213
214
215
216
217 ##
218 ## Définition du mot de passe BD
219 ##function set_db_password() {
220
221 stty -echo;
222 echo -n "Mot de passe pour la base de données [] ? "; read DB_PASSWD1;
223
224 if [ "$DB_PASSWD1" = "" ]; then
225 stty echo;
226 echo -e "\n\nGénération d'un mot de passe avec pwgen..."
227 DB_PASSWD=`pwgen 16 1`
228 echo "$DB_PASSWD"
229 return 0
230 fi
231 echo -ne "\nVeuillez retaper le mot de passe [] ? "; read DB_PASSWD2;
232 if [ $DB_PASSWD1 != $DB_PASSWD2 ]; then
233 echo -e "\n\nLes 2 mots de passe saisis sont dissérents !";
234 set_db_password
235 fi
236 stty echo;
237 DB_PASSWD=$DB_PASSWD1
238
239 return 0
240 }
241
242
243
244 ##
245 ## Définition des stats
246 ##
247 function set_awstats() {
248
249 echo -n "Activer les stats Awstats ? (o/[n]) "; read TMP_AWSTATS
250 if [ "$TMP_AWSTATS" = "o" -o "$TMP_AWSTATS" = "O" -o "$TMP_AWSTATS" = "y" -o "$TMP_AWSTATS" = "Y" ]; then
251 AWSTATS=0
252 else
253 AWSTATS=1
254 fi
255
256 return 0
257 }
258
259
260
261 ##
262 ## Définition du login htaccess pour awstats
263 ##
264 function set_awstats_login() {
265
266 echo -n "Login htaccess pour Awstats ? "; read AW_LOGIN
267
268 if [ "$AW_LOGIN" = "" ]; then
269 set_awstats_login
270 fi
271
272 return 0
273 }
274
275
276
277 ##
278 ## Définition du mot de passe htaccess pour awstats
279 ##
280 function set_awstats_password() {
281
282 stty -echo;
283 echo -n "Mot de passe htaccess pour Awstats [] ? "; read AW_PASSWD1;
284
285 if [ "$AW_PASSWD1" = "" ]; then
286 stty echo;
287 echo -e "\n\nGénération d'un mot de passe avec pwgen..."
288 AW_PASSWD=`pwgen 16 1`
289 echo "$AW_PASSWD"
290 return 0
291 fi
292 echo -ne "\nVeuillez retaper le mot de passe [] ? "; read AW_PASSWD2;
293 if [ $AW_PASSWD1 != $AW_PASSWD2 ]; then
294 echo -e "\n\nLes 2 mots de passe saisis sont dissérents !";
295 set_awstats_password
296 fi
297 stty echo;
298 AW_PASSWD=$AW_PASSWD1
299
300 return 0
301 }
302
303
304
305
306
307 ###################################
308 ##
309 ## Action de création du domaine
310 ##
311 ###################################
312
313 ##
314 ## Création des répertoires web
315 ##
316 function new_www() {
317
318 mkdir "$WWW_PATH"; echo "Création du répertoire $WWW_PATH"
319 mkdir "$WWW_PATH/www"; echo "Création du répertoire $WWW_PATH/www"
320 mkdir "$WWW_PATH/logs"; echo "Création du répertoire $WWW_PATH/logs"
321 mkdir "$WWW_PATH/awstats"; echo "Création du répertoire $WWW_PATH/awstats"
322
323 if [ "$PERM" != "" ]; then
324 chown "$PERM":"$PERM" "$WWW_PATH/www"; echo "Attribution des droits sur le répertoire www"
325 fi
326
327 return 0
328 }
329
330
331
332 ##
333 ## Configuration d'apache
334 ##
335 function new_vhost() {
336
337 new_vhost=`cat $VHOST_MODEL | \
338 sed "s,@@ServerAdmin@@,$SERVER_ADMIN,g" | \
339 sed -e "s,@@DocumentRoot@@,$WWW_PATH,g" | \
340 sed "s,@@ServerName@@,$WWW_URL,g"`
341
342 if [ $AWSTATS = 0 ]; then
343 new_vhost=`echo "$new_vhost"|sed "s,#@@,,g"`
344 fi
345
346 echo "$new_vhost" > "$VHOST_PATH/$WWW_URL"; echo "Configuration du VirtualHost"
347
348 vi "$VHOST_PATH/$WWW_URL"
349 return 0
350 }
351
352
353
354 ##
355 ## Configuration d'Awstats
356 ##function new_awstats() {
357 cat $AWSTATS_MODEL | \
358 sed -e "s,@@DocumentRoot@@,$WWW_PATH,g" | \
359 sed "s,@@ServerName@@,$WWW_URL,g" \
360 > "$AWSTATS_PATH/awstats.$WWW_URL.conf"; echo "Configuration des stats"
361
362 vi "$AWSTATS_PATH/awstats.$WWW_URL.conf"
363
364 htpasswd -cb $WWW_PATH/.htpasswdstats $AW_LOGIN $AW_PASSWD
365 return 0
366 }
367
368
369
370 ##
371 ## Création de la base de données
372 ##
373 function new_db() {
374 mysqladmin -u root create "$DB_NAME"
375 if [ $? -eq 0 ] ; then
376 echo "Base de données $DB_NAME créée avec succès"
377 else
378 echo "Erreur lors de la création de la base de données $DB_NAME"
379 return 1
380 fi
381
382 mysql -u root mysql -e "GRANT ALL ON \`$DB_NAME\`.* TO \"$DB_LOGIN\"@\"localhost\" IDENTIFIED BY \"$DB_PASSWD\";"
383 if [ $? -eq 0 ] ; then
384 echo "Utilisateur $DB_LOGIN créé avec succès"
385 else
386 echo "Erreur lors de la création de l'utilisateur $DB_LOGIN"
387 return 1
388 fi
389 return 0
390 }
391
392
393
394
395
396 ###################################
397 ##
398 ## Code brut
399 ##
400 ###################################
401
402 # Questions
403 echo -e "\nConfiguration du site"
404 echo -e "================================\n"
405 set_url
406 set_path
407
408 echo -e "\n\nConfiguration d'apache"
409 echo -e "================================\n"
410 set_serveradmin
411
412 echo -e "\n\nConfiguration de MySQL"
413 echo -e "================================\n"
414 set_db_name
415 if [ "$DB_NAME" != "" ]; then
416 set_db_login
417 set_db_password
418 fi
419
420 echo -e "\n\nConfiguration d'Awstats"
421 echo -e "================================\n"
422 set_awstats
423 if [ "$AWSTATS" = 0 ]; then
424 set_awstats_login
425 set_awstats_password
426 fi
427 echo -e "\n\n\n\n"
428
429
430 # Récapitulatif
431 recap
432 recap_valid 1
433
434
435 # All is good !
436 echo -e "\n\n"
437 new_www
438 new_vhost
439 if [ "$DB_NAME" != "" ]; then new_db; fi
440 if [ "$AWSTATS" = 0 ]; then new_awstats; fi
441
442 if [ "$MAIL_ADMIN" != "" ]; then
443 recap 0 | mail -s "Création d'un site sur le serveur `hostname`" to-addr "$MAIL_ADMIN"
444 fi
445
446 /root/bin/a2ensite $WWW_URL
Version modifiée du script a2dissite Debian pour tourner avec une autre distribution. Active un site web.
1 #!/bin/bash
2 ###############################################################################
3 #
4 # a2ensite : Reprise du a2ensite de la distribution Debian
5 #
6 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
7 # based on a Debian's script less anotation about owner.
8 # Version 1.0
9 #
10 ###############################################################################
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not,
23 # - write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 # - See http://www.gnu.org/licenses/gpl.html
26 ###############################################################################
27
28
29 # Varibles
30 SYSCONF_PATH='/etc/httpd' # Chemin vers la conf apache
31 HTTPD_RELOAD='/etc/init.d/httpd reload' # Commande pour relancer apache
32 SITE_AVAILABLE='sites-available' # Site en attente
33 SITE_ENABLED='sites-enabled' # Site activés
34
35
36 # Quel site ?
37 if [ -z $1 ]; then
38 echo "Quel site voulez vous activer ?"
39 echo "Votre choix est : "
40 for site in $SYSCONF_PATH/$SITE_AVAILABLE/*; do
41 echo -e "\t$site" | sed -e "s,$SYSCONF_PATH/$SITE_AVAILABLE/,,g"
42 done;
43 echo -n "Nom du site ? "
44 read SITENAME
45 else
46 SITENAME=$1
47 fi
48
49
50 # Site par défaut
51 if [ $SITENAME = "default" ]; then
52 PRIORITY="000"
53 fi
54
55
56 # Déjà activé ?
57 if [ -e $SYSCONF_PATH/$SITE_ENABLED/$SITENAME -o \
58 -e $SYSCONF_PATH/$SITE_ENABLED/"$PRIORITY"-"$SITENAME" ]; then
59 echo "Ce site est déjà activé ! ! !"
60 exit 0
61 fi
62
63
64 # Présent ?
65 if ! [ -e $SYSCONF_PATH/$SITE_AVAILABLE/$SITENAME ]; then
66 echo "Ce site n'existe pas ! ! !"
67 exit 1
68 fi
69
70
71 # Traitement :
72 if [ $SITENAME = "default" ]; then
73 ln -sf $SYSCONF_PATH/$SITE_AVAILABLE/$SITENAME \
74 $SYSCONF_PATH/$SITE_ENABLED/"$PRIORITY"-"$SITENAME"
75 else
76 ln -sf $SYSCONF_PATH/$SITE_AVAILABLE/$SITENAME $SYSCONF_PATH/$SITE_ENABLED/$SITENAME
77 fi
78
79
80 # Relancer apache ?
81 echo -n "Relancer Apache ? [o]/n : "
82 read RELOAD
83 if ! [ $RELOAD = "n" ]; then
84 $HTTPD_RELOAD
85 echo "Site $SITENAME installé et configuration rechargée."
86 else
87 echo "Site $SITENAME installé. Veuillez relancer apache !"
88 fi
Version modifiée du script a2dissite Debian pour tourner avec une autre distribution. Désactive un site web.
1 #!/bin/bash
2 ###############################################################################
3 #
4 # a2dissite : Reprise du a2dissite de la distribution Debian
5 #
6 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
7 # based on a Debian's script less anotation about owner.
8 # Version 1.0
9 #
10 ###############################################################################
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not,
23 # - write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 # - See http://www.gnu.org/licenses/gpl.html
26 ###############################################################################
27
28
29 # Varibles
30 SYSCONF_PATH='/etc/httpd' # Chemin vers la conf apache
31 HTTPD_RELOAD='/etc/init.d/httpd reload' # Commande pour relancer apache
32 SITE_AVAILABLE='sites-available' # Site en attente
33 SITE_ENABLED='sites-enabled' # Site activés
34
35 # Quel site ?
36 if [ -z $1 ]; then
37 echo "Quel site voulez vous désactiver ?"
38 echo "Votre choix est : "
39 for site in $SYSCONF_PATH/$SITE_ENABLED/*; do
40 echo -e "\t$site" | sed -e "s,$SYSCONF_PATH/$SITE_ENABLED/,,g"
41 done;
42 echo -n "Nom du site ? "
43 read SITENAME
44 else
45 SITENAME=$1
46 fi
47
48
49 # Site par défaut
50 if [ $SITENAME = "default" ]; then
51 PRIORITY="000"
52 fi
53
54
55 # Déjà désactivé ?
56 if ! [ -e $SYSCONF_PATH/$SITE_ENABLED/$SITENAME -o \
57 -e $SYSCONF_PATH/$SITE_ENABLED/"$PRIORITY"-"$SITENAME" ]; then
58 echo "Ce site est déjà désactivé ! ! !"
59 exit 1
60 fi
61
62
63 # Traitement :
64 if ! rm $SYSCONF_PATH/$SITE_ENABLED/$SITENAME 2>/dev/null; then
65 rm -f $SYSCONF_PATH/$SITE_ENABLED/"$PRIORITY"-"$SITENAME"
66 fi
67
68
69 # Relancer apache ?
70 echo -n "Relancer Apache ? [o]/n : "
71 read RELOAD
72 if ! [ $RELOAD = "n" ]; then
73 $HTTPD_RELOAD
74 echo "Site $SITENAME désinstallé et configuration rechargée."
75 else
76 echo "Site $SITENAME désinstallé. Veuillez relancer apache !"
77 fi
Idéal couplé à Nautilus Actions. Requiers Zenity
1 #!/bin/bash
2 ###############################################################################
3 #
4 # zsha1sum :
5 # Scripts permettant d'utiliser SHA1Sum avec une sortie dans Zenity.
6 #
7 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
8 # Version 1.0
9 #
10 ###############################################################################
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not,
23 # - write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 # - See http://www.gnu.org/licenses/gpl.html
26 ###############################################################################
27
28 if [ $# = 0 ]; then
29 zenity --info \
30 --width=600 \
31 --title="Usage incorrect de gSHA1Sum !" \
32 --text="L'usage correct est :
33 gSHA1Sum <fichier>";
34 exit
35 fi
36
37
38 action=`sha1sum $1`
39 zenity --info \
40 --title=SHA1SUM \
41 --no-wrap \
42 --text="SHA1Sum du fichier $1:\n
43 $action"
Need : - zenity - ffmpeg
1 #!/bin/bash
2 ###############################################################################
3 #
4 # convert2flv :
5 # Convert avi to flv.
6 # Need :
7 # - zenity
8 # - ffmpeg
9 #
10 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
11 # Version 1.0^M
12 #
13 ###############################################################################
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not,
26 # - write to the Free Software
27 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 # - See http://www.gnu.org/licenses/gpl.html^M
29 ###############################################################################
30
31
32 ###############################################################################
33 # Variables :
34 #
35 OPT_AR=22050
36 OPT_AB=32
37 OPT_S="320X240"
38 OPT_NAME="video.flv"
39 OPT_LOG=true
40
41
42
43
44 ###############################################################################
45 # Fonctions :
46 #
47 ##
48 # Définir le taux d’échantillonnage du son :
49 #
50 function setAr () {
51
52 OPT_AR=`zenity --entry --text="Taux d’échantillonnage" --entry-text=$OPT_AR`
53 }
54
55
56
57 ##
58 # Définir le audio bitrate en kbit / seconde :
59 #
60 function setAb () {
61
62 OPT_AB=`zenity --entry --text="Audio bitrate en kbit / seconde" --entry-text=$OPT_AB`
63 }
64
65
66
67 ##
68 # Définir les dimensions après conversion :
69 #
70 function setS () {
71
72 OPT_S=`zenity --entry --text="Dimensions après conversion" --entry-text=$OPT_S`
73 }
74
75
76
77 ##
78 # Définir les nom de la vidéo de sortie :
79 #
80 function setName () {
81
82 OPT_NAME=`zenity --entry --text="Non du fichier flv de sortie" --entry-text=$OPT_NAME`
83 }
84
85
86
87 ##
88 # Test l'appel du script :
89 #
90 function testArg () {
91 if [ $1 -lt 2 ]; then
92 zenity --info \
93 --width=600 \
94 --title="Usage incorrect de convert2flv !" \
95 --text="L'usage correct est :
96 convert2flv <Chemin vers le fichier> <Nom du fichier>";
97 exit
98 fi
99 }
100
101
102
103 ##
104 # Lancement
105 #
106 function convert () {
107
108 #Debug zenity --error --text="ffmpeg -i '$1/$2' -ar $OPT_AR -ab $OPT_AB -f flv -s $OPT_S '$1/$OPT_NAME'"
109 #echo "ffmpeg -i '$1/$2' -ar $OPT_AR -ab $OPT_AB -f flv -s $OPT_S '$1/$OPT_NAME'" > "$1/$OPT_NAME.log"
110 if [ $OPT_LOG = true ]; then
111 ffmpeg -y -i "$1/$2" -ar $OPT_AR -ab $OPT_AB -f flv -s $OPT_S "$1/$OPT_NAME" 2> "$1/$OPT_NAME.log"
112 zenity --text-info --filename="$1/$OPT_NAME.log"
113 else
114 ffmpeg -y -i "$1/$2" -ar $OPT_AR -ab $OPT_AB -f flv -s $OPT_S "$1/$OPT_NAME"
115 fi
116 }
117
118
119
120
121
122 ###############################################################################
123 # Code brut :
124 #
125 testArg $#
126 setAr
127 setAb
128 setS
129 setName
130 convert "$1" "$2"
Pages : 1