Forum des Objets Communicants et Solutions pour les Libérer...
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Forum des Objets Communicants et Solutions pour les Libérer...


 
AccueilAccueil  GalerieGalerie  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  
-29%
Le deal à ne pas rater :
PC portable Gamer ERAZER DEPUTY P60 – 15,6” FHD 144Hz – i7-12è ...
999.99 € 1399.99 €
Voir le deal

 

 karotz photo to email

Aller en bas 
AuteurMessage
carlo64
Bronze Nabz
Bronze Nabz



Localisation : italia
Nbr de messages : 162
Carottes : 3586

karotz photo to email Empty
MessageSujet: karotz photo to email   karotz photo to email Icon_minitimeDim 15 Mar 2015 - 10:56

Hi
I modified a script to send via email a Karotz photo
could be included in the usual crontab to send itself every few time you photos of the house in the office ...
code here

/usr/www/cgi-bin/snapshot_email
please change with your dates account

Code:

#!/bin/bash

source /www/cgi-bin/setup.inc
source /www/cgi-bin/url.inc
source /www/cgi-bin/utils.inc
source /www/cgi-bin/leds.inc
source /www/cgi-bin/ears.inc
source /www/cgi-bin/webcam.inc

KillProcess

ReadUrlParam
TDIR="/www/snapshots/"

# insert you dates
SMTP=smtp.gmail.com:587
USER=nameaccount@gmail.com
PWD=passwordaccount
FROM=nameaccount@gmail.com
TO=nameaccount@gmail.com
FILEMAIL=/tmp/m
 
FN="snapshot"_`date +'%Y_%m_%d_%H_%M_%S'`

TakeSnapshot

if [ ! -e "$CNF_DATADIR/Run/karotz.sleep" ]; then
  LedsRestore
  if [ "$SILENT" == "" ]; then
    PlaySound /usr/karotz/res/sounds/webcam.mp3
  fi
fi
  
if [ ! -e "/tmp/picture.jpg" ]; then
      Log  "Snapshot" "Unable to take snapshot" 1
      DATA='{"return":"1","msg":"Unable to take snapshot."}'
      SendResponse "$DATA"
      exit 0
fi


#
# create msg
#
echo "subject: foto $FN">$FILEMAIL
makemime /tmp/picture.jpg >>$FILEMAIL
#
# sendmail
#
sendmail -H "exec openssl s_client -quiet -connect $SMTP -tls1 -starttls smtp" -f $FROM  -au$USER -ap$PWD $TO 2> /tmp/sendmailerror <$FILEMAIL
#
# test error code
#
if [ $? -eq 0 ]; then
  DATA='{"filename":"'$FN'.jpg","return":"0"}'
else
  ERR=`cat /tmp/sendmailerror`
  DATA='{"message":"'$ERR'","return":"0"}'
  Log  "Snapshot" "Unable to send mail" 1
fi

SendResponse "$DATA"


 I used the gmail account and it was necessary to lower its level of security
( https://www.google.com/settings/security/lesssecureapps )


Carlo
Revenir en haut Aller en bas
 
karotz photo to email
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» karotz webcam
» Assistant Open Karotz. Libérez votre lapin sans passer par le site officiel !
» Karotz rouge: épidémie de mixomatose sur les serveurs Karotz
» Que fera le Karotz libéré ?
» Open Karotz Pour les nuls

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum des Objets Communicants et Solutions pour les Libérer... :: II. Nabaztag, Karotz, mir:ror, Dal:Dal (Violet Object Operating System) :: Le monde de Karotz-
Sauter vers: