running blender script via PHP shell_exec - ssh

Im trying to run the following command via my PHP script
$exe = "blender -b /var/www/renderer/tmp/abcd/abcd.blend -P /var/www/renderer/ -- -sx 300 -sy 600 -s 0.5 -sa 10";
$res = shell_exec( $exe );
The result im getting is
Read blend: /var/www/renderer/tmp/abcd/abcd.blend
Blender quit
Running the same script via SSH runs perfectly
What is wrong here ?


pass commands server using perl openssh

there are 2 systems,
client system,
in which i am passing commands to the server by doing openssh to the server and my script goes like this
use lib "/home/geek/app/usr/lib/perl5/site_perl/5.8.8";
use lib "/home/geek/app/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi";
use lib "/usr/lib/perl5/5.8.8";
use Net::OpenSSH;
my $host = '******010';
my $user = '*****';
my $pass = '*****';
my $ssh = Net::OpenSSH->new("$user:$pass\#$host");
$ssh->error and
die "Couldn't establish SSH connection: ". $ssh->error;
my $out = $ssh->capture("/p/inway/bin/inway71 lib123 p123.0_CC default ");
#my $out = $ssh->capture("cd units; ls");
#$out = $ssh->capture("ls units/");
print "output is $out";
and in server /p/inway/bin/inway71 is a scripts:
. $MODULESHOME/init/sh
module load lsf
exec bsub -Is -q interactive -J INWAY71_LSF -R 'type==X64LIN && osrel==50 && clearcase' /nfs/site/proj/inway/bin/inway71 ${1+"$#"}
so when i login to my server and run this script in my terminal, i will be directed to some path (i have no clue what it is, but i guess its one more server which i can login using this bash script) and i can do the rest of the activity like cd,ls,cat, etc etc)
but when i run this from my client system it passes the control to the terminal and waits for my input, and in my terminal i get an error saying,
stty:standard input:Invalid argument
In my terminal i can do ls or anything, but not able to do it from the perl script and capture the result.
How can i resolve this and get what i want?
That remote command expects to be run in interactive mode. This doesn't work with the SSH command mode. See this Net::OpenSSH FAQ!
You can:
find a way to pass commands as arguments to that script.
rewrite it to accept commands as arguments.
talk to it using Expect.

executing parameter file in a unix remote server

I am trying to run a script remotely using ssh and the need use some parameters from remote server. Kept all parameters in remote server location temp/test/test.prm file. Getting an error saying " line 20: . /temp/test/test.prm: No such file or directory "
See below for sample script. Have very basic knowledge in scripting so plz direct me
ssh usr#Server1
. ${Param1}/Client/scripts/Sample1.prm
cd $prmHome/$prmSetPath
ls | sed '/\.log$/d' > $prmHome/$prmScript/Filelist.txt
cd $prmHome/$prmScript
while read LINE
./ $prmHome/tmp_export/convert_$Param2.csv $prmHome/$prmSetPath/'$ExportFilName'
done < Filelist.txt
rm -rf $prmHome/$prmScript/Filelist.txt
exit 0
Content of Sample1.prm
I have tried the same trough command line after connecting to remote server using ssh and it is working, but when I am trying to do the same through a script ( its throwing no such file or directory error
This is unclear and will not work !
ssh usr#Server1
. ${Param1}/Client/scripts/Sample1.prm
As mentioned you should use
ssh usr#Server1 ". ${Param1}/Client/scripts/Sample1.prm"
format first.
And secondly what you expect following command to do ?
. ${Param1}/Client/scripts/Sample1.prm
Notice that there is a space in between . and the path, which is a synonym for source. So also check if the Sample1.prm have valid commands.
Looks like you are not running any ssh shell command on remote host but only on your local host.
How exactly you are running the ssh shell command ?
The code snippet in your example is poorly formatted.
The general structure should look like this e.g.
ssh user1#server1 date
ssh user1#server1 'df -H'
Please revise you invocation script, or make the formatting in the question appropriate.
If you want to execute your code on remote server via ssh, you can do following:
Create separate file for your code you want to run remotely, and paste following code:
function my_function() {
cd $prmHome/$prmSetPath
ls | sed '/\.log$/d' > $prmHome/$prmScript/Filelist.txt
cd $prmHome/$prmScript
while read LINE
./ $prmHome/tmp_export/convert_$Param2.csv $prmHome/$prmSetPath/'$ExportFilName'
done < Filelist.txt
rm -rf $prmHome/$prmScript/Filelist.txt
exit 0
Then you can call you function remotely, by sourcing your file on remote server:
ssh usr#Server1 '.; my_function "/iis/home" "/export/set" "/Client/scripts"'
That's it :)
This code will not work:
ssh usr#Server1
. ${Param1}/Client/scripts/Sample1.prm
Change it like that:
ssh usr#Server1 ". ${Param1}/Client/scripts/Sample1.prm"

Calling a script from Java

I have a java program that uses the JSch libraries. I can successfully call scripts from it, but when calling one script I have that calls another script, it doesn't end up calling the other one. I have tested it in command line and it works just fine. I know I am calling the script correctly from Java because part of it executes. The script is below.
# If there isn't any info for the movie
if [ ! -f "$MOVIE_ROOT/$MOVIE_FOLDER/$MOVIE_NAME.jpginfo" ] ; then
exit 0;
exit 0;
I also know that works as well. I have echod out the line cd "$MOVIE_ROOT... and pasted that into command line and it works fine. The only time it doesn't work is when I run the script from Java. All the scripts have correct permissions set and are chmod +x. Any ideas on what's going wrong?

php issue when running on linux with dot slash filename format

I have a script (file1.php)in php in linux
#!/usr/bin/php -q
echo "hello world" ?>
when i run in linux (redhat # bash shell)
> php file1.php
it works. my php is in /usr/bin/php and its version is 5.3.3)
but when i run
it says
'./file1.php' not present.
my application requires this ('./file1.php') model to work
on my other machine this file works with ('./file1.php') model
why is it so , is there any way to fix this ..
**/usr/bin/php -v works well
file permission (file1.php): -rwxr-xr-x 1 root root**
You should indicate how your file should be executed. In bash, it's done using a shebang
Try adding this line add the very top of your php script:
<?php echo 'Hello world!';
This would tell bash to run ./file.php as php /fullpath/file.php
More info

Automate scp website file transfer using a shell script

i have 3 digital ocean droplets, how to automate one droplet files to another 2 droplets, so i was write a scp shell script.
guys do you have any other suggestions or easily file transfer between two droplets?
#! /usr/bin/env bash
# Variables
echo -e "\n--- First Server files transferring now... ---\n"
sshpass -p "$SERVER1PSWD" scp -r /etc/var/html/www/ SERVER1USER#SERVER1IP:$SERVER1PATH
echo -e "\n--- Second Server files transferring now... ---\n"
sshpass -p "$SERVER2PSWD" scp -r /etc/var/html/www/ SERVER2USER#SERVER2IP:$SERVER2PATH
I prefer to program things like this in python. Below I have a sample of one script that I use to deploy hadoop to a cluster.
It can be expanded easily by adding more files, commands, or ips.
Note that I like being able to print everything that is going to be executed before I actually run it.
This is done with the DEBUG variable.
Also note, this can be accomplished in bash, but since I am not an accomplished Bash programmer, Python is much easier and less error prone for me.
import subprocess
call =
ips = []
for i in range(0,10):
commands = 'ls; echo "Hello"'
def hadoop_setup(ip):
sshTemplate = "ssh hdfs#%s '%s;'"
for eachCommand in commands.split(";"):
sshCall = sshTemplate%(ip, eachCommand)
if DEBUG: print sshCall
else: call(sshCall, shell=True)
copyFileTemplate = 'scp %s hdfs#%s:/home/hdfs'
for file in ['.bashrc']:
for ip in ips:
copyFileCall = copyFileTemplate%(file,ip)
call(copyFileCall, shell=True)