Re: Using IDL shell in crontab [message #56967 is a reply to message #56965] |
Sat, 24 November 2007 20:45   |
rkombiyil
Messages: 59 Registered: March 2006
|
Member |
|
|
On Nov 24, 10:07 pm, Bearstone <bearst...@gmail.com> wrote:
> I tried hard to get the answer on the web, but I got no clue.
>
> My problem is really simple.
>
> I draw simple figures with IDL code and it work without any problem.
>
> I use simple shell file like
>
> idl << EOF
> .run 1122.pro
> .run 1122-arsl.pro
> .run 1122size.pro
> EOF
>
> when I run it manually, it has no problem
>
> But when I put the shell file in crontab - because I have to draw
> figure every 10 minures- it doesn't work at all
>
> Crontab setting is like below
> */10 7-20 * * * /bin/csh /data1/kimws/skyrad/Seoul/POM01MKII/1122one-
> mk2.csh > /data1/kimws/skyrad/mk2.out
>
> If I just run manually on prompt like
> [arsl]/data1/kimws/skyrad/Seoul/POM01MKII{442}/data1/kimws/s kyrad/
> Seoul/POM01MKII/1122one-mk2.csh
>
> It works good.
> It's doesn't work only when it is in crontab.
>
> Other shell files that doesn't contain any IDL code work without any
> problem.
>
> How can I solve this problem? T.T
Hello there,
Usually, cron invokes the command from the user's HOME directory with
the shell, (/usr/bin/sh). A minimal default environment for every
shell is supplied, which defines:
HOME=YOUR HOME DIR
LOGNAME=YOUR USERID
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
If you need different ones you need to specify at the beginning of
your cronjob file. For example I wrote a small script called hello.sh
---------<begin script>----------
#!/bin/bash
# You can see from line #1 that I use bash, you can replace with
#this --->#!/bin/csh in your script
echo Hello World
--------<end script>-------------
So I edited crontab with crontab -e and added these lines to the
cronjob. I guess your problem will be solved with this one line given
below.
SHELL=/bin/bash
*/1 12-13 25 11 0 /bin/bash /home/hello.sh >~/hello.txt
and it works and writes "Hello world" to hello.txt "every minute"
without any problem. So your problem narrows down to "telling cron
what shell to use explicitly".
Good luck,
~rk
|
|
|