From: Russ P. on
On May 6, 4:16 pm, Michael Vilain <vil...(a)NOspamcop.net> wrote:
> In article
> <e3c1d24c-3442-4786-b711-c3276dbf9...(a)r11g2000yqa.googlegroups.com>,
>  "Russ P." <russ.paie...(a)gmail.com> wrote:
>
>
>
> > On May 6, 11:54 am, Bill Marcum <marcumb...(a)bellsouth.net> wrote:
> > > On 2010-05-06, Russ P. <russ.paie...(a)gmail.com> wrote:> I wrote a small csh
> > > script (on Linux) to run "make" (compile a
> > > > program). It works fine when I run it from the command line, but when
> > > > I try to run it with crontab, it doesn't work. I set the PATH variable
> > > > in the crontab file so it can find the script, but other environment
> > > > variables are apparently missing. How can I set the environment within
> > > > crontab to be exactly the same environment I have at the command line?
> > > > Thanks.
>
> > > Include commands to set the environment variables in your script, or
> > > source your .login or .cshrc files.
>
> > > --
> > > [It is] best to confuse only one issue at a time.
> > >                 -- K&R
>
> > I tried that, but I can't seem to get it to load. I put
>
> > source ~/.cshrc
>
> > in the crontab file, but I got this reply:
>
> > crontab: installing new crontab
> > "/tmp/crontab.XXXXCGDs5E":4: bad minute
> > errors in crontab file, can't install.
> > Do you want to retry the same edit? y
>
> > What is the proper syntax? Thanks.
>
> > Russ P.
>
> Most crond run the programs using sh by default, not csh.  I seem to
> recall you can specify the shell used but I may be wrong there.  Rewrite
> your script to use sh.  Not bash or ksh.  sh.  Yes, I know the default
> shell on some systems is bash, but if you write the lowest common
> denominator, you know it will run everywhere.
>
> Don't know sh.  Learn it and why it's the default for shell scripting
> rather than csh.
>
> --
> DeeDee, don't press that button!  DeeDee!  NO!  Dee...
> [I filter all Goggle Groups posts, so any reply may be automatically ignored]

Thanks for the suggestion, but I don't that is an option here. The
program I am trying to compile is heavily embedded in a csh
environment, and that is what I need to use.

I normally use bash, but in this case I am stuck with csh.

Russ P.
From: Keith Keller on
On 2010-05-06, Russ P. <russ.paielli(a)gmail.com> wrote:
>
> I tried that, but I can't seem to get it to load. I put
>
> source ~/.cshrc
>
> in the crontab file, but I got this reply:

Don't put it in your crontab. Write a script wrapper that does what you
want done, and call that from crontab. You can even test your script
from a nonlogin shell (which will emulate the crontab environment,
though not completely).

--keith


--
kkeller-usenet(a)wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

From: Seebs on
On 2010-05-06, Russ P. <russ.paielli(a)gmail.com> wrote:
> Thanks for the suggestion, but I don't that is an option here. The
> program I am trying to compile is heavily embedded in a csh
> environment, and that is what I need to use.

I am really confused.

You're *compiling* something in a crontab?

And the compilation is somehow able to depend on csh?

This sounds like a disaster-in-waiting to begin with. In any event, try
running "env" at a prompt (redirected to a file), then nuke any lines you're
sure don't matter, change the rest from
FOO=bar
to
setenv FOO bar
and append it to the script in question. That may do it.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Russ P. on
On May 6, 5:16 pm, Seebs <usenet-nos...(a)seebs.net> wrote:
> On 2010-05-06, Russ P. <russ.paie...(a)gmail.com> wrote:
>
> > Thanks for the suggestion, but I don't that is an option here. The
> > program I am trying to compile is heavily embedded in a csh
> > environment, and that is what I need to use.
>
> I am really confused.
>
> You're *compiling* something in a crontab?

What is confusing about that? It seems to me like a rather
straightforward thing to do.

Here's my situation. I am writing software that needs to communicate
through a socket with another large program. The other large program
is maintained in ClearCase, and I need to be able to compile it in my
ClearCase "view." That takes something like 10 to 20 minutes. So
rather than sit and wait for it, I figure I'll just have a cron job do
it for me in the middle of the night every night. Now, this large
program apparently depends on may environment variables that were set
up using csh. We have a "standard" cshrc file that others use, but I
use bash myself.

I took Keith Keller's suggestion to source .cshrc in the compilation
startup script, but that didn't solve my problem. I'm about ready to
just say to hell with it and just compile it from the command line.
Something is f***ed up -- maybe me. In any case, I certainly
appreciate the suggestions that were offered here.

Russ P.

> And the compilation is somehow able to depend on csh?
>
> This sounds like a disaster-in-waiting to begin with.  In any event, try
> running "env" at a prompt (redirected to a file), then nuke any lines you're
> sure don't matter, change the rest from
>         FOO=bar
> to
>         setenv FOO bar
> and append it to the script in question.  That may do it.
>
> -s
> --
> Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nos...(a)seebs.nethttp://www.seebs.net/log/<-- lawsuits, religion, and funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!

From: Seebs on
On 2010-05-07, Russ P. <russ.paielli(a)gmail.com> wrote:
> On May 6, 5:16�pm, Seebs <usenet-nos...(a)seebs.net> wrote:
>> On 2010-05-06, Russ P. <russ.paie...(a)gmail.com> wrote:
>>
>> > Thanks for the suggestion, but I don't that is an option here. The
>> > program I am trying to compile is heavily embedded in a csh
>> > environment, and that is what I need to use.
>>
>> I am really confused.
>>
>> You're *compiling* something in a crontab?

> What is confusing about that? It seems to me like a rather
> straightforward thing to do.

I guess automated builds exist, but it seems odd. Normally I use crontabs
for regular maintenance tasks, like *running* programs, but I build them
with a person there to watch the build.

Unless the source is changing, why compile it repeatedly?

> Here's my situation. I am writing software that needs to communicate
> through a socket with another large program. The other large program
> is maintained in ClearCase, and I need to be able to compile it in my
> ClearCase "view." That takes something like 10 to 20 minutes. So
> rather than sit and wait for it, I figure I'll just have a cron job do
> it for me in the middle of the night every night.

Ahhh!

> Now, this large
> program apparently depends on may environment variables that were set
> up using csh. We have a "standard" cshrc file that others use, but I
> use bash myself.

Okay.

Here's what I'd probably do:

#!/bin/sh
csh -c 'source /standard/cshrc; cd /path/to/source; make'

> I took Keith Keller's suggestion to source .cshrc in the compilation
> startup script, but that didn't solve my problem. I'm about ready to
> just say to hell with it and just compile it from the command line.
> Something is f***ed up -- maybe me. In any case, I certainly
> appreciate the suggestions that were offered here.

I'd mess around with env. Run a cron job to the effect of:
env | mail -s "cron environment" $yourname
and compare it with running 'env' in an environment where the build
succeeds.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!