log file remains empty

Hi

I'm not sure if I'm in the right section of the forum, but I hope someone can help me anyway. I'm logged onto my university server via ssh and execute a perl script. The output should be written into a log file.

I run the script like this:

perl scripts/test.pl scripts/Config.pm > log 2>&1 &

When I run it in my home directory without ssh, it works perfectly and I get the output plus error messages written into the log file. But when I'm logged in on the uni server and run the command, the log file remains empty. Sometimes it doesn't, but most of the times it is the case. When I look at the ongoing processes with the top command, I can see that the programme is running, but why do I have problems getting the output into the log file?

Thanks,

Kat

<DELETED>

I think after SSH the user account won't have permission to write on the existing script server, where your log path is. Please check it out.
You can do, output of SSH write in the remote server and do a scp to the local server. Please comment if you have better idea.

Thanks

Thanks. The file permissions are -rw-r--r-- and I'm the owner of the file, so I should be able to write into it?

I'm a newbie to unix, can you please explain how I write the output to my local server, or where I can find an instruction for that?

As you are doing the ssh , Even though you have the permission upon the file, the remote account user won't have that permission. Please give write permission to that file for "others".

I changed the permissions, but still the log remains empty!

Hi,

For running script in remote machine i suppose by default the file should have permission if you have created script with same user and the place where u are trying to write log file (default this will go to local server)

see the below sample i just tested.

serverA$ ssh user@serverB perl /home/location/test.pl  > /serverA/home/test.log
serverA$ more test.log
Hello world

HOpe this helps you..

Thanks
Sha

Hi Bloomy

What is the output in this way script runs on uni server

$ perl -d scripts/test.pl scripts/Config.pm > log 2>&1 &

Try this, it will redirect the output in remote server itself,

ssh user@ServerB "cd ServerB_Script_PATH; perl ScriptName > LogFilename"

-Ramesh