Score:0

Crontab, can't execute all the script

mx flag

I need to run daily a shell script which contains the steps of the model Weather Research Forecasting. I used cron for this. The first executable of the script (ungrib.exe) works perfect, but the second executable "metgrid.exe" it's not working at all. When I run the script in the terminal of linux works perfectly.

This is an example (summarized) of my script:

#!/bin/bash
bash #SCRIPTSDIR/download_gfs.sh
./link_grib.csh /home/user/WRF/GFS/
./ungrib.exe
ln -s metgrid/METGRID.TBL.ARW ./METGRID.TBL
./metgrid.exe <- not running with crontab

The way that I configure my crontab is:

crontab -e

SHELL=/bin/sh

00 01 * * * /home/user/WRF/scripts/WRF_scripts.sh

Any idea?

user535733 avatar
cn flag
Read your /var/log/syslog for cron actions --and errors-- at that time.
pmiranda avatar
mx flag
(CRON) info (No MTA installed, discarding output)
user535733 avatar
cn flag
That means there was an error. Are you familiar with the cron concept of *redirecting* output to a file? That way you can read the error message. See https://unix.stackexchange.com/questions/52330/ for instructions.
pmiranda avatar
mx flag
Now I'm trying something like this: `00 01 * * * /home/user/WRF/scripts/WRF_scripts.sh >> /home/user/log/file.txt 2>&1` plus `tail -f /home/user/log/file.txt` Let's see
Liso avatar
sd flag
Adding `&` suffix on `./ungrib.exe` will put it to background, then your script will carry on with the rest of the line.
muru avatar
us flag
`bash #SCRIPTSDIR/download_gfs.sh`? Is that `#` intentional? It'll start a comment
pmiranda avatar
mx flag
Yes, sorry, it was a mistake
pmiranda avatar
mx flag
Finally, I get it. I will put the answer later, I had to add some var to crontab envs
Score:0
mx flag

I added in my crontab the full path of libraries related with the execution of WRF.

LD_LIBRARY_PATH=$LD_LIBRARY_PATH 
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.