W dniu 5 września 2008 14:44 użytkownik Waldemar Dymkiewicz <waldemar.dymkiewicz@easy-com.pl> napisał:
Witam!
Stanąłem za potrzeba zrobienia przypominaczki kiedy sie koncza ludziom abonamenty, jednak pewna sprawa mnie pokonała.
To jest moja wersja przypominaczki ( 2 tygodnie przed konce abonamentu bedzie krzyczał codziennie dopoki nie wklepiesz mu przedłuzenia ) #!/bin/bash #zmienne sa w lms.ini ze spacja na poczatku user=`grep "^ user" /etc/lms/lms.ini | grep -v ';' | grep '=' | awk {'print $3'}` pass=`grep "^ password" /etc/lms/lms.ini | grep -v ';' | grep '=' | awk {'print $3'}` database=`grep "^ database" /etc/lms/lms.ini | grep -v ';' | grep '=' | awk {'print $3'}` query="mysql -u $user -p$pass -D $database -e" mailto="twojadresemail@asd" #mailto_cmd='cat /srv/users/internet/notfiy.msg | /usr/bin/mail -e -s Informacja jakisadresemail@com" ' NOW=`mysql --skip-column-names --silent --raw --disable-pager -u root -ptwojehaslo -e 'SELECT UNIX_TIMESTAMP()'` let "TWO_WEEKS_PLUS = $NOW + 1260000" for i in `mysql --skip-column-names -u root -ptwojehaslo -D lmsalarm -e "SELECT customerid FROM assignments where ( dateto < $TWO_WEEKS_PLUS and dateto > $NOW and datefrom < $NOW ) " ` do lastname=`mysql --skip-column-names -u root -ptwojehaslo -D lmsalarm -e "SELECT lastname from customers where id=$i"` phone=`mysql --skip-column-names -u root -ptwojehaslo -D lmsalarm -e "SELECT phone1 from customers where id=$i"` email=`mysql --skip-column-names -u root -ptwojehaslo -D lmsalarm -e "SELECT email from customers where id=$i"` unix_date_of_cutoff=`mysql --skip-column-names -u root -ptwojehaslo -D lmsalarm -e "SELECT dateto from assignments where customerid=$i "` fromunix_date_of_cutoff=`mysql --skip-column-names --silent --raw --disable-pager -u root -ptwojehaslo -e "SELECT FROM_UNIXTIME( $unix_date_of_cutoff ,'%d-%m-%Y')"` customerid_w_future_assignments=`mysql --skip-column-names -u root -ptwojehaslo -D lmsalarm -e "SELECT customerid from assignments where datefrom > $NOW and customerid=$i "` if [ -z $customerid_w_future_assignments ] then echo "Klient $lastname ($i) o danych : telefon $phone , email $email - zostanie niedlugo odciety ( $fromunix_date_of_cutoff ) -> https://beta.cebit.com.pl/lms/?m=customerinfo&id=$i " | mail -s "[lms] informacja o kliencie $lastname" $mailto fi done TRzeba było pogrzebac w kodzie C do demona. Tam jest duzo takich zapytan pozdr. -- Wojciech Ziniewicz Unix SEX :{look;gawk;find;sed;talk;grep;touch;finger;find;fl ex;unzip;head;tail; mount;workbone;fsck;yes;gasp;fsck;more;yes;yes;eje ct;umount;makeclean; zip;split;done;exit:xargs!!;)} !DSPAM:48c1469b312355750622685!