Re: [gentoo-user] crontab - and' condition

2014-09-21 Thread Peter Humphrey
On Saturday 20 September 2014 12:09:32 Michael Orlitzky wrote:

 This is one of my favorite old seriously? bugs:
 
   https://bugs.gentoo.org/show_bug.cgi?id=69777

Round and round and round we go. Wonderful!

-- 
Regards
Peter




Re: [gentoo-user] crontab - and' condition

2014-09-20 Thread Michael Orlitzky
On 09/19/2014 03:09 AM, Alan McKinnon wrote:
 
 No wait, that won't work. What you want to accomplish cannot be done
 with a single crontab job.
 
 Use periodic/monthly like the other poster said or use anacron so the
 job will run when the machine is next powered on.
 

Actually, Gentoo's sys-process/cronbase is supposed to make sure that
this happens. But the way it works is poorly (i.e. not) specified. This
is one of my favorite old seriously? bugs:

  https://bugs.gentoo.org/show_bug.cgi?id=69777




Re: [gentoo-user] crontab - and' condition

2014-09-20 Thread Joseph

On 09/19/14 09:47, Stephan Müller wrote:

Am 18.09.2014 um 18:44 schrieb Joseph:

I want to run a cron job only once a month.  The problem is the computer is 
only on on weekdays Mon-Fri. 1-5
cron tab as this below is an or condition as it has entries in Days of the 
Months and Day of the  Week

5 18 1 * 2  rsync -av ...

so it will run on days 1 or Tuesday of each months.
Is it possible to create and condition, eg. run it on Tuesday between days 1 
to 7; depend on which day Tuesday falls on?


You can run it every Tuesday and check for day of month externally:

5 18 * * 2   test $(date +%d) -le 7  rsync -av ...

or run it on

5 18 1-7 * * and test for Tuesdays, but the former gives less useless 
invocations.

~frukto


Thanks, very cleaver, I knew there must be a solution.

--
Joseph



Re: [gentoo-user] crontab - and' condition

2014-09-19 Thread Alan McKinnon
On 19/09/2014 06:21, Joseph wrote:
 On 09/18/14 19:14, Alan McKinnon wrote:
 On 18/09/2014 18:44, Joseph wrote:
 I want to run a cron job only once a month.  The problem is the computer
 is only on on weekdays Mon-Fri. 1-5

 cron tab as this below is an or condition as it has entries in Days of
 the Months and Day of the  Week

 5 18 1 * 2  rsync -av ...

 so it will run on days 1 or Tuesday of each months.

 Is it possible to create and condition, eg. run it on Tuesday between
 days 1 to 7; depend on which day Tuesday falls on?


 Not in one line.

 Split it into two crontab entries.
 
 Interesting.  How do you split cron job? I couldn't find any examples.
 


No wait, that won't work. What you want to accomplish cannot be done
with a single crontab job.

Use periodic/monthly like the other poster said or use anacron so the
job will run when the machine is next powered on.


-- 
Alan McKinnon
alan.mckin...@gmail.com




Re: [gentoo-user] crontab - and' condition

2014-09-19 Thread Stephan Müller
Am 18.09.2014 um 18:44 schrieb Joseph:
 I want to run a cron job only once a month.  The problem is the computer is 
 only on on weekdays Mon-Fri. 1-5
 cron tab as this below is an or condition as it has entries in Days of the 
 Months and Day of the  Week
 
 5 18 1 * 2  rsync -av ...
 
 so it will run on days 1 or Tuesday of each months.
 Is it possible to create and condition, eg. run it on Tuesday between days 
 1 to 7; depend on which day Tuesday falls on?

You can run it every Tuesday and check for day of month externally:

5 18 * * 2   test $(date +%d) -le 7  rsync -av ...

or run it on

5 18 1-7 * * and test for Tuesdays, but the former gives less useless 
invocations.

 ~frukto 






Re: [gentoo-user] crontab - and' condition

2014-09-18 Thread Kerin Millar

On 18/09/2014 17:44, Joseph wrote:

I want to run a cron job only once a month.  The problem is the computer
is only on on weekdays Mon-Fri. 1-5

cron tab as this below is an or condition as it has entries in Days of
the Months and Day of the  Week

5 18 1 * 2  rsync -av ...

so it will run on days 1 or Tuesday of each months.

Is it possible to create and condition, eg. run it on Tuesday between
days 1 to 7; depend on which day Tuesday falls on?


You can place a script in /etc/cron.monthly. The run-crons script is 
scheduled to execute every 10 minutes, and it will ensure that your 
script is executed on a monthly schedule. This is true of both cronie 
and vixie-cron.


--Kerin



Re: [gentoo-user] crontab - and' condition

2014-09-18 Thread Alan McKinnon
On 18/09/2014 18:44, Joseph wrote:
 I want to run a cron job only once a month.  The problem is the computer
 is only on on weekdays Mon-Fri. 1-5
 
 cron tab as this below is an or condition as it has entries in Days of
 the Months and Day of the  Week
 
 5 18 1 * 2  rsync -av ...
 
 so it will run on days 1 or Tuesday of each months.
 
 Is it possible to create and condition, eg. run it on Tuesday between
 days 1 to 7; depend on which day Tuesday falls on?


Not in one line.

Split it into two crontab entries.



-- 
Alan McKinnon
alan.mckin...@gmail.com




Re: [gentoo-user] crontab - and' condition

2014-09-18 Thread Joseph

On 09/18/14 19:14, Alan McKinnon wrote:

On 18/09/2014 18:44, Joseph wrote:

I want to run a cron job only once a month.  The problem is the computer
is only on on weekdays Mon-Fri. 1-5

cron tab as this below is an or condition as it has entries in Days of
the Months and Day of the  Week

5 18 1 * 2  rsync -av ...

so it will run on days 1 or Tuesday of each months.

Is it possible to create and condition, eg. run it on Tuesday between
days 1 to 7; depend on which day Tuesday falls on?



Not in one line.

Split it into two crontab entries.


Interesting.  How do you split cron job? I couldn't find any examples.

--
Joseph