sub run_command { my ($in_prompt,$in_command)=@_; print $rlogin "$in_command\r"; $rlogin->expect(300,'-re',$in_prompt); }#end run_command sub rlogin { my ($in_hostname,$in_password,$in_prompt,$in_type)=@_; $rlogin=Expect->spawn($in_type." ".$in_hostname); $rlogin->expect(300,"ssword:") || die "Never got password prompt on $host, ".$rlogin->exp_error()."\n"; print $rlogin "$in_password\r"; $match=$rlogin->expect(300,"closed by foreign host","-re",$in_prompt); #Used for debugging I think #die "Dumped by server\n" if $match == 1; #die "Never got shell prompt on $host, ".$rlogin->exp_error()."\n" unless $match; }#end rlogin rlogin($hostname,$password,$prompt,"ssh"); run_command($prompt,"export ORACLE_SID=$oracle_sid"); run_command($prompt,"cd dev"); run_command($prompt,"chmod +x *"); run_command($prompt,"exp $schema/$schema file=$file log=$log rows=no"); run_command($prompt,"imp $schema/$schema file=$file indexfile=$indexfile full=y"); run_command($prompt,"./initial.pl ".$schema."_tabind LOC_".$touser." $touser $schema ");