Re: Scheduling Jobs - Last day of the month - HOWTO?



I don't know exactly what your script is supposed to do but wouldn't that be
better to run the script on the first day of each month? When there is some
operation which is date related just subtract one day, omit data from
current day, etc. I find it better than think of those weird inteligentlike
constructions. Please, no offence, Chris. I just think that such scripts
are often sources of problems.

Michal Vojan


Chris F.A. Johnson wrote:

On 2006-08-30, Michael B Johnson wrote:
I would like to schedule a job on the last day of each month.

When I looked through the man pages for Cron, there did not appear to be
any obvious mechanism for specifying the *last day* of the month.

Unfortunately, my environment is Cygwin, and the job to be launched
(executable) was written in Visual Basic 6. I have access to "bash" via
cygwin, as well as perl and awk.


0 0 31 1,3,5,7,8,10,12 * /path/to/script
0 0 30 9,4,6,11 * /path/to/script
0 0 28,29 2 * /path/to/wrapperscript

In the wrapperscript, called only in February, check whether the
current year is a leap year:

eval "$(date "$@" "+year=%Y day=%d)"
case $year in
*0[48] |\
*[2468][048] |\
*[13579][26] |\
*[02468][048]00 |\
*[13579][26]00 ) [ ${day#0} -eq 29 ] && /path/to/script ;;
*) [ ${day#0} -eq 28 ] && /path/to/script ;;
esac
}



.



Relevant Pages

  • Re: Linux build in Windows
    ... ">> The solution shown above will run (under Cygwin) on the MS-Windows box! ... "> script are Windows programs. ... Is it possible to run such commands from ...
    (comp.os.linux.misc)
  • cygwin CRON problem
    ... I'm able to access the local files by not the NETWORK files from cygwin ... However the same script runs perfectly from the cygwin shell ... Then it doesn't work from CRON. ... command line it works correctly. ...
    (comp.os.linux.networking)
  • cygwin CRON problem
    ... I'm able to access the local files by not the NETWORK files from cygwin ... However the same script runs perfectly from the cygwin shell ... Then it doesn't work from CRON. ... command line it works correctly. ...
    (comp.os.linux.setup)
  • RE: Search NTFS share permissions
    ... This may get a little tricky with free software, but if you're script savvy, ... I personally use cygwin along with ... Subject: Search NTFS share permissions ...
    (Focus-Microsoft)
  • Re: OCIEnvNlsCreate error with DBD::Oracle 1.21 and Oracle 10g client in Cygwin
    ... I am able to connect to all databases from the cygwin prompt, but am unable to get the script to connect. ... I have all the below-mentioned environment variables set in the Windows environment as well, which cygwin picks up at start-up as well. ... I have tried all variations of the DBI->connect statement mentioned in the perldocs in the script below, but continue to encounter the OCIEnvNlsCreate error. ... Subject: OCIEnvNlsCreate error with DBD::Oracle 1.21 and Oracle 10g client in Cygwin ...
    (perl.dbi.users)