Skip to main content
added 107 characters in body
Source Link
slm
  • 380k
  • 127
  • 793
  • 897

Using a compute cluster?

Since you're asking about qsub I'm going to assume you're using GridEngineGridEngine or some computer clustering productcomputer clustering product.

qsub

When you run the command qsub script_name.sh you're telling the cluster's head node that you want to submit a script to run on that server. So that server would need to have access to the same filesystem's that contain the script. For example if your script lives here, /home/myusername/script_name.sh, this file would need to be accessible on both the computer you're running the qsub command on as well as any node in your cluster where you intend script_name.sh to run.

Running a script

When you run the script, ./script_name.sh you're not running anything on the cluster. You're running this script locally on your system. If you've used a command to gain a shell on the cluster, qsh, then you're running this command on whatever node the cluster's scheduler node decided to give you a shell on.

Permissions

Any time you make a script and intend to run it, you have to tell the system your intents, by changing the script's permissions such that they reflect that the file is executable. Otherwise the file is not a script, but just a text file.

You can see a files permissions like so:

some script

$ cat script_name.sh #!/bin/bash echo "hello world" 

not executable

$ ls -l script_name.sh -rw-rw-r--. 1 saml saml 32 Feb 25 18:11 script_name.sh $ ./script_name.sh bash: ./script_name.sh: Permission denied 

executable

$ chmod +x script_name.sh $ ls -l script_name.sh -rwxrwxr-x. 1 saml saml 32 Feb 25 18:11 script_name.sh $ ./script_name.sh hello world 

Using a compute cluster?

Since you're asking about qsub I'm going to assume you're using GridEngine or some computer clustering product.

qsub

When you run the command qsub script_name.sh you're telling the cluster's head node that you want to submit a script to run on that server. So that server would need to have access to the same filesystem's that contain the script. For example if your script lives here, /home/myusername/script_name.sh, this file would need to be accessible on both the computer you're running the qsub command on as well as any node in your cluster where you intend script_name.sh to run.

Running a script

When you run the script, ./script_name.sh you're not running anything on the cluster. You're running this script locally on your system. If you've used a command to gain a shell on the cluster, qsh, then you're running this command on whatever node the cluster's scheduler node decided to give you a shell on.

Permissions

Any time you make a script and intend to run it, you have to tell the system your intents, by changing the script's permissions such that they reflect that the file is executable. Otherwise the file is not a script, but just a text file.

You can see a files permissions like so:

some script

$ cat script_name.sh #!/bin/bash echo "hello world" 

not executable

$ ls -l script_name.sh -rw-rw-r--. 1 saml saml 32 Feb 25 18:11 script_name.sh $ ./script_name.sh bash: ./script_name.sh: Permission denied 

executable

$ chmod +x script_name.sh $ ls -l script_name.sh -rwxrwxr-x. 1 saml saml 32 Feb 25 18:11 script_name.sh $ ./script_name.sh hello world 

Using a compute cluster?

Since you're asking about qsub I'm going to assume you're using GridEngine or some computer clustering product.

qsub

When you run the command qsub script_name.sh you're telling the cluster's head node that you want to submit a script to run on that server. So that server would need to have access to the same filesystem's that contain the script. For example if your script lives here, /home/myusername/script_name.sh, this file would need to be accessible on both the computer you're running the qsub command on as well as any node in your cluster where you intend script_name.sh to run.

Running a script

When you run the script, ./script_name.sh you're not running anything on the cluster. You're running this script locally on your system. If you've used a command to gain a shell on the cluster, qsh, then you're running this command on whatever node the cluster's scheduler node decided to give you a shell on.

Permissions

Any time you make a script and intend to run it, you have to tell the system your intents, by changing the script's permissions such that they reflect that the file is executable. Otherwise the file is not a script, but just a text file.

You can see a files permissions like so:

some script

$ cat script_name.sh #!/bin/bash echo "hello world" 

not executable

$ ls -l script_name.sh -rw-rw-r--. 1 saml saml 32 Feb 25 18:11 script_name.sh $ ./script_name.sh bash: ./script_name.sh: Permission denied 

executable

$ chmod +x script_name.sh $ ls -l script_name.sh -rwxrwxr-x. 1 saml saml 32 Feb 25 18:11 script_name.sh $ ./script_name.sh hello world 
Source Link
slm
  • 380k
  • 127
  • 793
  • 897

Using a compute cluster?

Since you're asking about qsub I'm going to assume you're using GridEngine or some computer clustering product.

qsub

When you run the command qsub script_name.sh you're telling the cluster's head node that you want to submit a script to run on that server. So that server would need to have access to the same filesystem's that contain the script. For example if your script lives here, /home/myusername/script_name.sh, this file would need to be accessible on both the computer you're running the qsub command on as well as any node in your cluster where you intend script_name.sh to run.

Running a script

When you run the script, ./script_name.sh you're not running anything on the cluster. You're running this script locally on your system. If you've used a command to gain a shell on the cluster, qsh, then you're running this command on whatever node the cluster's scheduler node decided to give you a shell on.

Permissions

Any time you make a script and intend to run it, you have to tell the system your intents, by changing the script's permissions such that they reflect that the file is executable. Otherwise the file is not a script, but just a text file.

You can see a files permissions like so:

some script

$ cat script_name.sh #!/bin/bash echo "hello world" 

not executable

$ ls -l script_name.sh -rw-rw-r--. 1 saml saml 32 Feb 25 18:11 script_name.sh $ ./script_name.sh bash: ./script_name.sh: Permission denied 

executable

$ chmod +x script_name.sh $ ls -l script_name.sh -rwxrwxr-x. 1 saml saml 32 Feb 25 18:11 script_name.sh $ ./script_name.sh hello world