On Fri, 2005-02-11 at 00:43 -0700, Craig White wrote: > On Thu, 2005-02-10 at 23:44 -0700, der.hans wrote: > So the problems that were manifest - I have a number of variables passed > to my shell script from Webmin - values of which are obtained by adding > a line '/bin/env > /tmp/env.txt' in my shell script. > > The value of LDAPADMIN_USER must be passed from the shell script to the > perl script so that it deletes the right mailbox. I have tested each > step by declaring the value of LDAPADMIN_USER at the start of each shell > script and then comment it out to test it from within Webmin. > > The biggest problem I have now is returning the value of 'success' to > perl based Webmin. If you can tell me how to do that, I would be ever > grateful....I am working with 'return 0' but that isn't making Webmin > happy. ---- OK - I got this worked out - no return values need to be supplied, the execution must be perfect and that's fine. I should admit that after every successful mailbox delete, I re-create it so that it shouldn't fail just because it doesn't exist. I still can't get variable passed from shell script to perl script. If I run this perl script - first uncommenting the variable USERADMIN_USER it runs fine. #! /usr/bin/perl -w #my $USERADMIN_USER='test2'; use Cyrus::IMAP::Admin; $imap = Cyrus::IMAP::Admin->new("localhost") or die "Failed to connect"; $imap->authenticate("-user" => "cyrus", "-password" => "PASSWD", "-mechanism" => "LOGIN") or die "Failed to authenticate"; $imap->setacl("user.$USERADMIN_USER", "cyrus" => "+c"); $imap->delete("user.$USERADMIN_USER"); die $imap->error if $imap->error; but if I comment out the assignment of the USERADMIN_USER variable so it is passed from calling script, it apparently is never passed... # cat ldap_useradmin.after #!/bin/sh USERADMIN_ACTION="DELETE_USER" USERADMIN_USER="test2" #export USERADMIN_USER if [ "${USERADMIN_ACTION}" = "ADD_USER" ]; then /root/scripts/ldap_useradmin.addabook fi if [ "${USERADMIN_ACTION}" = "DELETE_USER" ]; then /root/scripts/ldap_useradmin.delmail.pl fi and this experiment shows the 'export USERADMIN_USER' line commented out but the result is the same whether it is or isn't commented... # ./ldap_useradmin.after Use of uninitialized value in concatenation (.) or string at /root/scripts/ldap_useradmin.delmail.pl line 13. Use of uninitialized value in concatenation (.) or string at /root/scripts/ldap_useradmin.delmail.pl line 14. Mailbox does not exist at /root/scripts/ldap_useradmin.delmail.pl line 15. now if I run ldap_useradmin.delmail.pl by itself # ./ldap_useradmin.delmail.pl Use of uninitialized value in concatenation (.) or string at ./ldap_useradmin.delmail.pl line 13. Use of uninitialized value in concatenation (.) or string at ./ldap_useradmin.delmail.pl line 14. Mailbox does not exist at ./ldap_useradmin.delmail.pl line 15. same results - but if I remove the comment from the line my #my $USERADMIN_USER='test2'; and then run it again it is happy. # ./ldap_useradmin.delmail.pl [root@linuxserver scripts]# and of course, mailbox is deleted I find it incredibly frustrating to trace the problems - this clearly indicates to me that variable USERADMIN_USER doesn't get passed from the shell script ldap_useradmin.after to the perl script ldap_useradmin.delmail.pl Lemme see now, I've only put in like 6 hours on these 2 short scripts and the other 2 extremely short shell scripts that are working fine. ARRGH!!! Craig --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change you mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss