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
