hello everyone,

thank you for your responses.

I've tried moving everything to one file 'test.sh'
with the contents below:

#!/bin/bash


if [ -f inlist_user_input ]

    then

     cd /var/www/virtual/mesa-web.asu.edu/html/services &&

     cp inlist_user_input /var/www/virtual/
mesa-web.asu.edu/html/services/Work/ &&

     rm /var/www/virtual/mesa-web.asu.edu/html/services/inlist_user_input &&

     cd /var/www/virtual/mesa-web.asu.edu/html/services/Work &&

     ./bang.sh

    else

   exit

fi


where bang.sh:



#!/bin/bash

whoami > 'out.txt'

sbatch calculate.job




Where calculate.job:

#!/bin/bash

#SBATCH -p compute

#SBATCH -N 1

#SBATCH -n 1

#SBATCH --time=00:10:00

#SBATCH --mail-type=ALL

#SBATCH [email protected]

#SBATCH --error=job.%J.err

#SBATCH --output=job.%J.out



srun ./rn





crontab executes eve thing fine except the batch command, which works when
run as SlurmUser by hand. I have the bang script before the batch is being
executed, print the user, to ensure its the slurm user.


Any further suggestions would be welcomed.


Thanks,


Carl





On Wed, Apr 1, 2015 at 2:19 PM, Inigo Aldazabal Mensa <
[email protected]> wrote:

>
> On Wed, 01 Apr 2015 13:13:38 -0700
> "Carl E. Fields" <[email protected]> wrote:
>
> > Hi Everyone,
> >
> > I wish to have crontab check every minute for the existence of a file,
> > then if such file exists, execute "sbatch calculate.sh".
> >
> > crontab is written as:
> >
> > * * * * * SlurmUser
> > cd /var/www/virtual/mesa-web.asu.edu/html/services
> > && /bin/sh ./test.sh
> >
> > the file test.sh contains:
> >
> > #!/bin/bash
> >
> >
> > if [ -f inlist_user_input ]
> >
> >     then
> >
> >     sbatch calculate.sh > 'rn.txt'
> >
> >     else
> >
> >    exit
> >
> > fi
> >
> >
> >
> > lastly, calculate.sh is a typical job batch script
> >
> > When i $ ./test.sh by hand
> >
> > I get the typical out put "Submitted job id ##" to the rn.txt file
> >
> > However, when I have crontab do the same thing,
> > rn.txt is created, but empty.
> >
> > Can crontab processes execute sbatch commands? Am I missing a
> > particular permission setting?
>
> Are you sure calculate.sh is in the same path where sbatch is run from?
>
> If it's not sbatch will just dump an error, which output would no be in
> your rn.txt as it'd go to stderr, and exit.
>
> I'd add the cd part to the test.sh script itself.
>
> Inigo
>
>
> > all files involved are executable by "SlurmUser"
> >
> > Thanks ahead of time,
> >
> > Carl
>

Reply via email to