what does && mean in cron

what does && mean in cron

Post by mathew pet » Fri, 28 Sep 2001 01:11:51



What does '&&' mean between two entries on a crontab.
eg 00 07 /usr/bin/ksh -c /job1.sh && /job2.sh

Does it mean start job2 after job1 completes
or does it mean start job1 and job2 simultaneously

Thanks
Matt

 
 
 

what does && mean in cron

Post by Paul Brandariz x654 » Fri, 28 Sep 2001 01:28:53



> What does '&&' mean between two entries on a crontab.
> eg 00 07 /usr/bin/ksh -c /job1.sh && /job2.sh

A && B

If A succeeds run B....

Quote:

> Does it mean start job2 after job1 completes
> or does it mean start job1 and job2 simultaneously

> Thanks
> Matt

--
___________________________________________________________________________

KLA-Tencor  Corporation
One Technology Dr.
Milpitas, CA 95035

 
 
 

what does && mean in cron

Post by Erik Max Franci » Fri, 28 Sep 2001 01:33:58



> What does '&&' mean between two entries on a crontab.
> eg 00 07 /usr/bin/ksh -c /job1.sh && /job2.sh

> Does it mean start job2 after job1 completes
> or does it mean start job1 and job2 simultaneously

The former, and additionally that job2 starts after job1 completes
_successfully_ (returns error code zero).

Executing

        x && y

is equivalent to

        if x
        then
            y
        fi

but is much more compact.

--

 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ I get my kicks above the wasteline, sunshine
\__/ The American, _Chess_
    Product's Quake III Arena Tips / http://www.bosskey.net/
 Tips and tricks from the absolute beginner to the Arena Master.

 
 
 

what does && mean in cron

Post by Paul D. Smit » Fri, 28 Sep 2001 02:18:24




  >> What does '&&' mean between two entries on a crontab.
  >> eg 00 07 /usr/bin/ksh -c /job1.sh && /job2.sh
  >>
  >> Does it mean start job2 after job1 completes
  >> or does it mean start job1 and job2 simultaneously

  emf> The former, and additionally that job2 starts after job1 completes
  emf> _successfully_ (returns error code zero).

The important thing to note is that the command line to be executed in a
cron job is not in any special "cron language".

It's just a shell script.

So, what you want to ask is, "what does the && operator do in Bourne
shell?"

Erik gave the answer, but so would your local shell man page, I daresay :).

--
-------------------------------------------------------------------------------

 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.

 
 
 

what does && mean in cron

Post by scott douglas » Sat, 29 Sep 2001 20:15:16



> Executing

>         x && y

> is equivalent to

>         if x
>         then
>             y
>         fi

> but is much more compact.

Almost equivalent:  if x returns non-zero status
    x && y
returns the same non-zero status, but
    if x ; then y ; fi
returns zero status.

I expect this is POSIX-mandated behavior but I
don't have access to a copy of the standard.

 
 
 

what does && mean in cron

Post by scott douglas » Sat, 29 Sep 2001 20:14:44



> Executing

>         x && y

> is equivalent to

>         if x
>         then
>             y
>         fi

> but is much more compact.

Almost equivalent:  if x returns non-zero status
    x && y
returns the same non-zero status, but
    if x ; then y ; fi
returns zero status.

I expect this is POSIX-mandated behavior but I
don't have access to a copy of the standard.