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         | [EMAIL PROTECTED] | VIM is
http://tzafrir.org.il |                           | a Mutt's  
[EMAIL PROTECTED] |                           |  best
ICQ# 16849755         |                           | friend
_______________________________________________
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to