Sponsored Content
Full Discussion: End of Month - Cron Jobs
Top Forums Shell Programming and Scripting End of Month - Cron Jobs Post 302281335 by jthompson333 on Wednesday 28th of January 2009 04:33:16 PM
Old 01-28-2009
End of Month - Cron Jobs

I am running AIX 5.3 with the default shell as ksh.

I would like to know how to run a cron job on this system the last calendar day of the month. I found an example, but, I'm not sure if it will work with AIX and ksh...

Code:
02 16 * * * [ $(date +%d) -eq $(echo $(cal) | awk '{print $NF}') ] && /home/user/job-eom.ksh

I also need to be able to run a job on every day except the last calendar of the month (actually a series of jobs, but, I assume I can adopt the syntax for multiple jobs).

So to summarize:

I would like to run the following jobs where specified EXCEPT on the LAST calendar day of the month.

Code:
50   21   *   *   *   /home/user/eod-job1.ksh
00   22   *   *   *   /home/user/eod-job2.ksh
10   22   *   *   0   /home/user/eod-job3.ksh
10   22   *   *   1-4   /home/user/eod-job4.ksh
00   23   *   *   1   /home/user/eod-job5.ksh
10   22   *   *   5-6   /home/user/eod-job6.ksh
50   4    *   *   *   /home/user/eod-job7.ksh

And I would like to run another job ON the LAST calendar day of the month, and probably a couple of others...

Code:
45   20   *   *   *   /home/user/eom-job1.ksh

I'm also fairly new at shell scripting, etc., especially ksh.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cron Jobs

Where can someone find info on Cron Jobs? Very new to UNIX and the PC I inherited looks to have several of them. Looks like they are some kind of background program that runs automatically at specified times. Would like to delete some of them and know more about them. (6 Replies)
Discussion started by: dereckbc
6 Replies

2. UNIX for Advanced & Expert Users

Unix Cron Month End Processing

Is it possible to use cron to schedule a job that will run the first 3 Sunday's during a month in addition to the last day of the month? (3 Replies)
Discussion started by: cpete
3 Replies

3. UNIX for Dummies Questions & Answers

setting up cron job for month end week report

Hi all, Needs your help in scheduling a cron job for the below mentioned requirement. Just let me know if anybody has a similar job running as mentioned below: Month end reports - Report of all items created in a parent table that were created during the week. Presently this report runs... (3 Replies)
Discussion started by: Bhups
3 Replies

4. UNIX for Advanced & Expert Users

last month end date

Hi, How to get the lastmonth's end date? (have current date) through s shell script. I need to get it and pass it to a procedure. Please advice. Thanks in advance. (7 Replies)
Discussion started by: vanathi
7 Replies

5. Shell Programming and Scripting

fetching Month end using cal

Hi , Can someone please assist to get monthend using cal utility and monthend shouldn't be saturday or sunday. Cheers, gehlnar (2 Replies)
Discussion started by: gehlnar
2 Replies

6. Solaris

Cron jobs and at jobs

There are two jobs in Solaris , Cron and at jobs.. I know how to disable or enable cron jobs. How can I enable at jobs and disable it. Kindly help. Rj (2 Replies)
Discussion started by: jegaraman
2 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Cancelling print jobs for an entire month

Hi pals, Pls tel me how to cancel print jobs for an entire month (ex : sept)? lpstat -oLBNDUIP061 | grep -i Sep is listing me hundreds of jobs. Thanks in Advance, Satish Video tutorial on how to use code tags in The UNIX and Linux Forums. (22 Replies)
Discussion started by: satish51392111
22 Replies

8. Shell Programming and Scripting

Cron for end of month

Hello, I'm on FreeBSD 8.2-STABLE shell and I was trying the following cron entry for end of month: 59 23 * * * && /home/user/eomt.sh >/dev/null 2>&1 I get the following error Subject: Cron <user@shell> eomt.sh contains the following codes #!/bin/sh rm /home/user/tst/logs/* &&... (9 Replies)
Discussion started by: user`
9 Replies

9. UNIX for Dummies Questions & Answers

Get the next month end date

how to get the next month end date. dt=01312014 output=02282014 (2 Replies)
Discussion started by: w020637
2 Replies

10. Shell Programming and Scripting

Cron Jobs

How to see which cron jobs are not running? (2 Replies)
Discussion started by: rahul.raj1989
2 Replies
let(1)                                                             User Commands                                                            let(1)

NAME
let - shell built-in function to evaluate one or more arithmetic expressions SYNOPSIS
ksh let arg... DESCRIPTION
ksh Each arg is a separate "arithmetic expression" to be evaluated. EXIT STATUS
The following exit values are returned: 0 The value of the last expression is non-zero. 1 The value of the last expression is zero. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
ksh(1), set(1), typeset(1), attributes(5) SunOS 5.10 15 Apr 1994 let(1)
All times are GMT -4. The time now is 12:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy