diff --git a/mxstartup2mxvipcfg b/mxstartup2mxvipcfg
index 6144b1a..7b05a98 100755
--- a/mxstartup2mxvipcfg
+++ b/mxstartup2mxvipcfg
@@ -23,6 +23,10 @@ while(!($packed_ip=gethostbyname($fullhostname))) {
 
 my $hostip = inet_ntoa($packed_ip);
 
+if(defined $ARGV[0]) {
+   $rundir = $ARGV[0];
+}
+
 unless(-d $rundir and -w $rundir) {
    print STDERR "can't write to directory $rundir\n";
    exit 1;