[Asterisk-Users] Voicemail Passwords and RealTime

Tzafrir Cohen tzafrir at cohens.org.il
Tue Oct 11 23:35:35 MST 2005


On Tue, Oct 11, 2005 at 05:37:12PM -0600, Ryan Hulsker wrote:

> 
> mine looks like this
> 
> #!/usr/bin/perl
> # Takes 3 command line args, context, mailbox, password
> # updates the mailbox password in mysql
> 
> use strict;
> use DBI;
> 
> my ($Context, $MailBox, $Password) = @ARGV;
> 
> my $dbh =
> DBI->connect("dbi:mysql:hostname=localhost;database=asterisk","username", "password");
> 
> $dbh->do("update voicemail_users set password = '$Password' where
> context = '$Context' and mailbox = '$MailBox'");
> 
> $dbh->disconnect();

OT:

Why do people resort to perl just for such a simple script?

#!/bin/sh
mysql asterisk -e "update voicemail_users set password = '$3' where context = '$1' and MailBox = '$2'"

Password/hostname, etc. can wither be hard-wired at the command-line or 
using my.cnf (or an alternative my.cnf in the command-line parameters).

-- 
Tzafrir Cohen         | tzafrir at jbr.cohens.org.il | VIM is
http://tzafrir.org.il |                           | a Mutt's  
tzafrir at cohens.org.il |                           |  best
ICQ# 16849755         |                           | friend



More information about the asterisk-users mailing list