HylaFAX The world's
most advanced open source fax server
|
|
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
[hylafax-users] copy notify file
Hello, excuse me for my bad english.
I using the notify script, but it missing a option to copy the generate file
by notify for backup in directory share by samba. Now everyone access to
file.
Salut, j'utilise le script notify, mais il manquait une option pour copier
les fichiers générés par notify dans un répertoire partagé par samba. Après
modification tout le monde peut avoir accès au fichier sans avoir besoin de
regarder dans toute les boites au lettres pour savoir qui a envoyé quoi. Et
surtout le nom du fichier n'est plus composé uniquement du numéro de fax du
destinataire.
Pour envoyer les fax j'utilise Whfc avec l'option annuaire mysql activé, ce
qui me permet de récupérer les informations contenue dans la base des
numéros pour composer le nom du fichier.
-------- After ----------
MIMEBOUNDARY="NextPart$$"
RETURNTECHINFO=no
------- Add -------------
BACKUPFILE=yes
DB_SERV=server mysql
DB_NAME=data base
DB_USER=user
DB_PASS=pass
DB_TABLE=table of fax number
DB_CHAMP_NOM=name of the fields which contains the recipients
DB_CHAMP_FAX=name of the fields which contains the fax number
BIN_MYSQL=access path to the client mysql
-------------------------
-------- parseQfile() --------------
parseQfile()
{
eval `($AWK -F: ' function p(varname,val)
{
...
END { p("nfiles", nfiles); p("npins", npins) } ' $QFILE )`
# Recuperation du nom du destinataire dans
# l'annuaire Whfc
NomDestinataire
}
-----------------------------------
---- add function mysql ---------------
NomDestinataire()
# Recuperation du nom du destinataire
# dans la base annuaire de Whfc
{
NUMFAX="$number"
RESULT=`$BIN_MYSQL/mysql --batch --silent --raw \
--host=$DB_SERV \
--user=$DB_USER \
--password=$DB_PASS \
--execute="SELECT $DB_CHAMP_NOM FROM $DB_TABLE WHERE
$DB_CHAMP_FAX=$NUMFAX;" \
$DB_NAME \
| sed 's/[ ,?;.:/!§ù%*µ$£]//g'`
RESULT_NB=`echo $RESULT | sed 's/ /\n/g' | wc -l`
if [ "$RESULT_NB" -ne "1" ] then
DEST=`echo $RESULT | cut -d ' ' -f1`
else
DEST=$RESULT
fi
}
------------------------------------------------
--------- In putPdfEncodedImage(), putPsEncodedImage(), putTifEncodedImage()
if [ "$BACKUPFILE" = "yes" ] ; then
CpFile
return
fi
---------------------------------------------------------------------------
------------------------------------------------
CpFile()
# Copie les fichiers dans un répertoire
{
VDATE=`date +%d-%m-%Y_%H-%M-%S`
VNUM="$number"
VMAIL="$mailaddr"
VUNDER="_"
VFAIL="echoue"
VDONE="reussi"
VBLOCK="bloque"
VREJECT="rejete"
# Controle de l'état d'envoi
if [ "$WHY" = "failed" ] ; then
if [ $RETURNFILETYPE = "tif" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VFAIL.tif"
cp "$OUTFILE" "backup/tif/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "pdf" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VFAIL.pdf
cp "$OUTFILE" "backup/pdf/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "ps" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VFAIL.ps"
cp "$OUTFILE" "backup/ps/$FIC" > $ERRORSTO 2>&1
else
return
fi
elif [ "$WHY" = "rejected" ] ; then
if [ $RETURNFILETYPE = "tif" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VREJECT.tif"
cp "$OUTFILE" "backup/tif/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "pdf" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VREJECT.pdf"
cp "$OUTFILE" "backup/pdf/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "ps" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VREJECT.ps"
cp "$OUTFILE" "backup/ps/$FIC" > $ERRORSTO 2>&1
else
return
fi
elif [ "$WHY" = "done" ] ; then
if [ $RETURNFILETYPE = "tif" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VDONE.tif"
cp "$OUTFILE" "backup/tif/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "pdf" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VDONE.pdf"
cp "$OUTFILE" "backup/pdf/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "ps" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VDONE.ps"
cp "$OUTFILE" "backup/ps/$FIC" > $ERRORSTO 2>&1
else
return
fi
elif [ "$WHY" = "blocked" ] ; then
if [ $RETURNFILETYPE = "tif" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VBLOCK.tif"
cp "$OUTFILE" "backup/tif/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "pdf" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VBLOCK.pdf"
cp "$OUTFILE" "backup/pdf/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "ps" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER$VBLOCK.ps"
cp "$OUTFILE" "backup/ps/$FIC" > $ERRORSTO 2>&1
else
return
fi
else
if [ $RETURNFILETYPE = "tif" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER.tif"
cp "$OUTFILE" "backup/tif/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "pdf" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER.pdf"
cp "$OUTFILE" "backup/pdf/$FIC" > $ERRORSTO 2>&1
elif [ $RETURNFILETYPE = "ps" ] ; then
FIC="$DEST$VUNDER$VNUM$VUNDER$VDATE$VUNDER$VMAIL$VUNDER.ps"
cp "$OUTFILE" "backup/ps/$FIC" > $ERRORSTO 2>&1
else
return
fi
fi
}
--------------------------------------------------------
------ returnFaxImage() -----------
remplace : ENCODEDFILENAME="$number-$i.tif"
by : ENCODEDFILENAME="$DEST-$number-$i.tif"
-----------------------------------
Repeat in different function for return the files (ps, pdf...)
Now you can use $DEST anywhere in notify.
_________________________________
HILAIRE s.a. - Philippe MALADJIAN
205 rue Jean Voillot
69100 VILLEURBANNE
tél. : 04 72 1450 66
fax : 04 78 26 02 03
e-mail : pmaladjian@xxxxxxxxxx
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*