in reply to Re: Re: Taking Input And Running In Script
in thread Taking Input And Running In Script
#!/usr/bin/perl -w use strict; use Getopt::Long; my ($username, $password, $domain); my $result = GetOptions("username=s" => \$username, "password=s" => \$password, "domain=s" => \$domain ); system("/usr/sbin/adduser $username -g 100 -s /bin/false -d /home/$use +rname -p $password"); if( $? >> 8 == 0 ) { # success open (VFILE, ">> virtual"); # you should check for failure here print VFILE "$username\@ap3k.com\t$username\n"; close (VFILE); # Do you need to check this? system ("postmap /etc/postfix/virtual"); } else { print STDERR "bailing with ret code of ", $? >> 8, "\n"; }
see system on interpretting return codes (that shifty bit stuff).
-derby
|
|---|