I have a script that pushes out a perl script to multiple machines and collects system information. These are all Solaris 10 spare servers. Everything works great accept my directory creation on the remote machine. If I login and run it manually it works fine, but does not work when I run it from my wrapper script.

My system_info.pl is copied to /tmp on the remote machine using scp and expect. It then runs with sudo locally.

Here are a few lines from the wrapper and system_info script.

my wrapper contains the following sudo command to execute the system_info.pl locally.

Code

$sudo_cmd = "cd /tmp ; sudo perl system_info.pl ; exit";

and here is part of the expect piece that runs the command

Code

[ qr/admin\@$server\s*\$\s/ => sub { $cmd->send("$sudo_cmd\n"); } ],

The system_info.pl script that is copied contain's the following lines to create the directory. Again tis works if I login and run system_info.pl manually, but not remotely with the wrapper.