- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: cron job
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 12:32 AM
тАО01-18-2011 12:32 AM
I need to create a cron entry to execute a script.
I need to execute that script like for this year 2011 as
29th Jan,
26th Feb,
31st Mar,
28th April,
31st May,
30th June,
29th July,
30th Aug,
30th Sep,
28th Oct,
30th Nov and
29th Dec
and the time is at 10:30pm.
Please help me to create a cron job with the above and also explain me the entry how it works.
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 12:57 AM
тАО01-18-2011 12:57 AM
Re: cron job
30 22 29 1 * <script>
This will run on Jan 29th @ 10:30pm. After this, you need to change the date and month to execute for next month.
Shibin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 12:59 AM
тАО01-18-2011 12:59 AM
Re: cron job
30 10 29 * * <script>
This will run on 29th of the month. You need to change the date to execute it on another date.
Shibin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 01:07 AM
тАО01-18-2011 01:07 AM
Re: cron job
you can put entries in crontab individualy for each month.
For eg: for Jan
30 10 29 1 * /path/script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 01:08 AM
тАО01-18-2011 01:08 AM
Re: cron job
you could run the script every day,
and inside the script you will check if the current day ( os date ) is the same as your list of dates.
mikap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 01:14 AM
тАО01-18-2011 01:14 AM
Re: cron job
30 22 29 1 * /path/script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 01:25 AM
тАО01-18-2011 01:25 AM
Re: cron job
Or include in your script a header that checks the execution on these specific days:
DAY_TO_EXECUTE=`date +%d%m`
case in $DATE_TO_EXECUE
do
2901|2602|3103|2804|3105|3006|2907|3008|3009|2810|3011|2912) **Include your procedure**
;;
*) exit
;;
esac
In this case you needs schedule a daily entry in your crontab to call the script, then the script only executes the conditions filtered into the case syntax.
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 01:35 AM
тАО01-18-2011 01:35 AM
Solutionecho "sh /path/to/the/script" | at 1030 Jan 29
echo "sh /path/to/the/script" | at 1030 Feb 26
echo "sh /path/to/the/script" | at 1030 Mar 31
echo "sh /path/to/the/script" | at 1030 Apr 31
echo "sh /path/to/the/script" | at 1030 May 31
echo "sh /path/to/the/script" | at 1030 Jun 30
echo "sh /path/to/the/script" | at 1030 Jul 29
echo "sh /path/to/the/script" | at 1030 Aug 30
echo "sh /path/to/the/script" | at 1030 Sep 30
echo "sh /path/to/the/script" | at 1030 Oct 28
echo "sh /path/to/the/script" | at 1030 Nov 30
echo "sh /path/to/the/script" | at 1030 Dec 29
For the next year, you'd have to set up a new set of at jobs; unlike cron jobs, at jobs are executed once and then removed from the list of scheduled jobs.
You might want to set up another job to remind yourself (or someone else) of that:
echo "mail -s 'REMINDER: set up a new series of at jobs for 2012' S.S@company.example" | at 1031 Dec 29
Use "at -l" to verify the list of at jobs.
In HP-UX, the cron daemon runs both cron and at jobs. Some other variants of Unix might have a separate "at daemon" for at jobs.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 01:48 AM - last edited on тАО11-10-2011 09:03 AM by Kevin_Paul
тАО01-18-2011 01:48 AM - last edited on тАО11-10-2011 09:03 AM by Kevin_Paul
Re: cron job
MK given a wonderful solution with 'at' jobs
Looks at the alternatives gives by Dennis
using a shell script
http://h30499.www3.hp.com/t5/Languages-and-Scripting/Cron-job-scheduling-last-saturday-of-month/m-p/4739252#M29429
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2011 02:40 AM
тАО01-18-2011 02:40 AM
Re: cron job
Rgds.