Executing a bash script in Oracle/Sun GridEngine - variables

I have a script which begins by defining a series of variables, before running a programme with those variables. However, the script is being rejected from Grid Engine (it works on a workstation, but as one component of an array job, it needs to run via SGE) because the variables are being read as commands, resulting in a "Command not found" response.
The error is completely reproduced using the following:
#!/bin/bash
#$ -M not.real#email.address
#$ -m be
#$ -o /scratch/MScGWAS/Output
#$ -e /scratch/MScGWAS/Errors
#$ -q long.q
#$ -cwd
CHR=$1
CHUNK_START=`printf "%.0f" $2`
CHUNK_END=`printf "%.0f" $3`
Output Example:
CHR=1: Command not found.
CHUNK_START=1: Command not found.
CHUNK_END=5000000: Command not found.
How can I get GridEngine to use bash as the interpreter for this script?

You are not executing your script with bash, but with a different shell (e.g. tcsh).

It sounds like your grid engine cluster is configured with the queues in posix_compliant mode and /bin/csh as the default shell. In posix_compliant mode the initial #! is ignored and you need to specify the shell via a command line switch or with a suitable #$ directive.
Adding the following line to your script should work:
#$ -S /bin/bash

Related

Run multiple commands using wsl

I have some scripts on my home folder that I would like to run from command line, actually from the task scheduler, but I don't find the way to do so.
I have tried
wsl -u Ubuntu -u jlanza "cd /home/jlanza/bin && ./myscript && ./myotherscript"
but it doesn't work.
How can I concatenate the execution of several commands under the same session?
You need to escape && so powershell does not see them as different commands, to pass && to wsl do the following:
wsl -d Ubuntu -u jlanza -- cd /home/jlanza/bin `&`& ./myscript `&`& ./myotherscript
You need to pass those commands to WSL without the quotes so that bash interprets them correctly as a series of commands chained together, rather than a single long command. Unfortunately, when you do that, the '&&' operator gets interpreted by the Windows command line interpreter and the commands following do not get passed to WSL.
What I've found to work is replacing the '&&' (run command only if the preceeding command exits with success) operator with simple ';' (run command regardless of how the preceeding command exited). In your case then, something like this should work:
cmd /c "wsl -u Ubuntu -u jlanza cd /home/jlanza/bin; ./myscript; ./myotherscript"
However, if your use cases neccesitates the use of the '&&' operator, I'd try saving the command you're running as a script or an shell alias in the WSL. Calling that would then save you the need of passing '&&' through the Windows command line interpreter.
C:\Windows\System32\wsl.exe -d Ubuntu -u jlanza sh -c ". ~/.profile && script-jlanza.sh"
This way I load my own own profile and then I'm able to run the commands.
The option is just to run sh or any shell and then execute the commands you'd like within that shell. The other answer is also valid, but I like mine most, as I'm able to use the user profile (path, aliases, etc.)

Run RapSearch-Program with Torque PBS and qsub

My problem is that I have a cluster-server with Torque PBS and want to use it to run a sequence-comparison with the program rapsearch.
The normal RapSearch command is:
./rapsearch -q protein.fasta -d database -o output -e 0.001 -v 10 -x t -z 32
Now I want to run it with 2 nodes on the cluster-server.
I've tried with: echo "./rapsearch -q protein.fasta -d database -o output -e 0.001 -v 10 -x t -z 32" | qsub -l nodes=2 but nothing happened.
Do you have any suggestions? Where I'm wrong? Help please.
Standard output (and error output) files are placed in your home directory by default; take a look. You are looking for a file named STDIN.e[numbers], it will contain the error message.
However, I see that you're using ./rapsearch but are not really being explicit about what directory you're in. Your problem is therefore probably a matter of changing directory into the directory that you submitted from. When your terminal is in the directory of the rapsearch executable, try echo "cd \$PBS_O_WORKDIR && ./rapsearch [arguments]" | qsub [arguments] to submit your job to the cluster.
Other tips:
You could add rapsearch to your path if you use it often. Then you can use it like a regular command anywhere. It's a matter of adding the line export PATH=/full/path/to/rapsearch/bin:$PATH to your .bashrc file.
Create a submission script for use with qsub. Here is a good example.

Capistrano: cap staging git:check - how to configure ssh path in git-ssh.sh?

I want to figure out how to set the path to ssh in git-ssh.sh file copied to the server by capistrano after executing the deploy command.
Actually the second line of git-ssh.sh looks like:
exec /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no "$#"
I can not execute this command directly on the server. The following error occurs:
[5b4fcea9] /tmp/app.de/git-ssh.sh: line 2: /usr/bin/ssh: No such file or directory
After editing the ssh path to /usr/local/bin/ssh it works well but capistrano will upload this file every time calling cap staging deploy.
See my logs on pastie for more details, specially in the git:check part:
http://pastie.org/9523811
It is possible to set this path in my deploy.rb?
Thanks & cheers
Mirko
Yeah, i got it. :))
Rake::Task["deploy:check"].clear_actions
namespace :deploy do
task check: :'git:wrapper' do
on release_roles :all do
execute :mkdir, "-p", "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
upload! StringIO.new("#!/bin/sh -e\nexec /usr/local/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$#\"\n"), "#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh"
execute :chmod, "+x", "#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh"
end
end
end
This line seems to be hardcoded in capistrano source code link here.
Instead of changing capistrano source, why don't you create /usr/bin/ssh symlink on the server? So this:
ln -s /usr/local/bin/ssh /usr/bin/ssh
That will create a /usr/bin/ssh symlink that, when executed, will run /usr/local/bin/ssh.
In your Capfile if you add the following line you can override the git tasks:
require 'capistrano/git'

plink unable to execute the command with parameters

i could not able to execute the command with parameters in the plink.exe, when i provide the parameter command 'ls', it executes perfectly.
but if i provide command with parameters let's say 'ls -ltr', it say's commmand not found, this command executes perfectly in the unix command shell.
source code
c:\Gopal\putty>PLINK.exe -ssh gopc#hyperlvs03.qa.paypal.com -i c:\gopal\putty\gopc-private-key.ppk 'ls'
5036
BR-SWAT
CustomerOnBoardingEmailDataVO.oml~
GOPC.PG.conf
GOPC.PG.log
GOPC2.PG.conf
GOPC2.PG.log
GOPC2_PG.py
GOPC2_PG.pyc
GOPC_PG.py
GOPC_PG.pyc
GTest
Mail
\
afiedt.buf
color.sh
color.txt
compile.ksh
compile.ksh.bkup
error_log
file_backup_script.ksh
file_comp.txt
file_comp.txt_dev_BR_SWAT_38350
file_comp.txt_webdev_BR_SWAT_38350
file_not_found.txt
files_diff.txt
files_diff_compare.sh
gimp
gopc-0af4ba41-7528-20110810-211015190-cc_confirm.confirm_cc.vo.req.xml
i686
logs
mm-logs
mycommit
oradiag_UNKNOWN
oradiag_gopc
projects
public_html
scratch
scripts
stage.txt
tr
web.log
c:\Gopal\putty>PLINK.exe -ssh gopc#hyperlvs03.qa.paypal.com -i c:\gopal\putty\gopc-private-key.ppk 'ls -ltr'
bash: ls -ltr: command not found
please find the screen shot for the reference.

zsh ssh-add -L parse error near `-L'

I'm trying to run
ssh-add -L
(or any other dashed option), and zsh returns zsh: parse error near `-L'. It's the first time I see zsh do that, and it doesn't do it with any other command.
Any ideas ?
First thing to find out is whether ssh-add is an alias or a shell function, rather than the binary executable /usr/bin/ssh-add.
Second, try to run the same command in a ZSH session without your custom ZSH configuration. To get a clean environment, run
env -i TERM=$TERM LC_ALL=$LC_ALL LANG=$LANG zsh -f
Then try ssh-add -L again and let us know what you see.
Moreover, please post the output of the following:
uname -a
zsh --version