What is the best way to run a job on the last day of
every month? I am assuming cron has some symbol that
says "last day of every month" since every month
doesn't have the same number of days. I didn't
see it in the man page.
Thanks!
-Rod
You can post here or send a line to rmach at umich edu
What is the best way to run a job on the last day of
every month? I am assuming cron has some symbol that
says "last day of every month" since every month
doesn't have the same number of days. I didn't
see it in the man page.
Thanks!
-Rod
You can post here or send a line to rmach at umich edu
What is the best way to run a job on the last day of
every month? I am assuming cron has some symbol that
says "last day of every month" since every month
doesn't have the same number of days. I didn't
see it in the man page.
Thanks!
-Rod
You can post here or send a line to rmach at umich edu
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote:
What is the best way to run a job on the last day of
every month? I am assuming cron has some symbol that
says "last day of every month" since every month
doesn't have the same number of days. I didn't
see it in the man page.
Thanks!
-Rod
You can post here or send a line to rmach at umich edu
You can use any job scheduling toll to server the same.
one such tool is autosys which is capable of scheduling, monitoring, and reporting.
So you use autosys calendar functionality and set it up for every month last day.
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote:
What is the best way to run a job on the last day of
every month? I am assuming cron has some symbol that
says "last day of every month" since every month
doesn't have the same number of days. I didn't
see it in the man page.
Thanks!
-Rod
You can post here or send a line to rmach at umich edu
You can use any job scheduling tool to server your requirement.
and one of such tool is autosys which is capable of scheduling,
monitoring, and reporting.
You use autosys calendar functionality and set it up for every month
last day.
Naren
https://www.tracedynamics.com/autosys/
On Sat, 23 Jun 2018 18:46:10 -0700 (PDT)
tracedynamics@gmail.com wrote:
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote:
What is the best way to run a job on the last day of
every month? I am assuming cron has some symbol that
says "last day of every month" since every month
doesn't have the same number of days. I didn't
see it in the man page.
Thanks!
-Rod
You can post here or send a line to rmach at umich edu
You can use any job scheduling tool to server your requirement.
and one of such tool is autosys which is capable of scheduling,
monitoring, and reporting.
You use autosys calendar functionality and set it up for every month
last day.
Naren
https://www.tracedynamics.com/autosys/
Yeah but he asked how to do it in Cron. I am curious as well.
On Sat, 23 Jun 2018 18:46:10 -0700 (PDT)
tracedynamics@gmail.com wrote:
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote:
What is the best way to run a job on the last day of
every month?
Yeah but he asked how to do it in Cron. I am curious as well.
On Sat, 23 Jun 2018 22:06:57 -0700, tom wrote:
On Sat, 23 Jun 2018 18:46:10 -0700 (PDT)
tracedynamics@gmail.com wrote:
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote:
What is the best way to run a job on the last day of
every month?
<snip>
Yeah but he asked how to do it in Cron. I am curious as well.
Sounds easy to me. Put a script in cron daily and use the calendar
program to get last day of month and compare with current day of month.
If current day is not last day exit. Suggested reading:
man date
man cal
man test
For example:
#!/bin/bash
Current_Day_of_Month=$(date '+%_d')
Last_Day_of_Month=$(set $(cal);shift $(( $# - 1));echo $1)
if [ $Current_Day_of_Month -ne $Last_Day_of_Month ] ; then
exit 0
fi
code for last day of month goes here
Bit Twister wrote:
On Sat, 23 Jun 2018 22:06:57 -0700, tom wrote:
On Sat, 23 Jun 2018 18:46:10 -0700 (PDT)
tracedynamics@gmail.com wrote:
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote:
What is the best way to run a job on the last day of
every month?
<snip>
Yeah but he asked how to do it in Cron. I am curious as well.
Sounds easy to me. Put a script in cron daily and use the calendar
program to get last day of month and compare with current day of month.
If current day is not last day exit. Suggested reading:
man date
man cal
man test
For example:
#!/bin/bash
Current_Day_of_Month=$(date '+%_d')
Last_Day_of_Month=$(set $(cal);shift $(( $# - 1));echo $1)
if [ $Current_Day_of_Month -ne $Last_Day_of_Month ] ; then
exit 0
fi
code for last day of month goes here
Alternatively....
#!/bin/bash
# If tomorrow is the 1st of the month,
# then today is the last day of the month
[ $(date +%-d -d tomorrow) != 1 ] && exit 0
# code for last day of the month goes here
On Thu, 28 Jun 2018 17:25:39 -0400, Lew Pitcher wrote:
Bit Twister wrote:
On Sat, 23 Jun 2018 22:06:57 -0700, tom wrote:
On Sat, 23 Jun 2018 18:46:10 -0700 (PDT)
tracedynamics@gmail.com wrote:
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote:
What is the best way to run a job on the last day of
every month?
<snip>
Yeah but he asked how to do it in Cron. I am curious as well.
Sounds easy to me. Put a script in cron daily and use the calendar
program to get last day of month and compare with current day of month.
If current day is not last day exit. Suggested reading:
man date
man cal
man test
For example:
#!/bin/bash
Current_Day_of_Month=$(date '+%_d')
Last_Day_of_Month=$(set $(cal);shift $(( $# - 1));echo $1)
if [ $Current_Day_of_Month -ne $Last_Day_of_Month ] ; then
exit 0
fi
code for last day of month goes here
Alternatively....
#!/bin/bash
# If tomorrow is the 1st of the month,
# then today is the last day of the month
[ $(date +%-d -d tomorrow) != 1 ] && exit 0
# code for last day of the month goes here
Cute. I like it. I wish I could think like that.
Bit Twister wrote:
On Thu, 28 Jun 2018 17:25:39 -0400, Lew Pitcher wrote:
Bit Twister wrote:
On Sat, 23 Jun 2018 22:06:57 -0700, tom wrote:
On Sat, 23 Jun 2018 18:46:10 -0700 (PDT)
tracedynamics@gmail.com wrote:
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote:
What is the best way to run a job on the last day of
every month?
<snip>
Yeah but he asked how to do it in Cron. I am curious as well.
Sounds easy to me. Put a script in cron daily and use the calendar
program to get last day of month and compare with current day of month. >>>> If current day is not last day exit. Suggested reading:
man date
man cal
man test
For example:
#!/bin/bash
Current_Day_of_Month=$(date '+%_d')
Last_Day_of_Month=$(set $(cal);shift $(( $# - 1));echo $1)
if [ $Current_Day_of_Month -ne $Last_Day_of_Month ] ; then
exit 0
fi
code for last day of month goes here
Alternatively....
#!/bin/bash
# If tomorrow is the 1st of the month,
# then today is the last day of the month
[ $(date +%-d -d tomorrow) != 1 ] && exit 0
# code for last day of the month goes here
Cute. I like it. I wish I could think like that.
It may be possible (should be possible, but I've never tried it) to incorporate this test directly into the crontab entry, rather than requiring the crontab entry to run a shell script.
Something like
1 0 28-31 * * [ $(date +%-d -d tomorrow) = 1 ] && do_this
where
do_this
is the path to the executable to be executed on the last day of the month.
On Fri, 29 Jun 2018 10:54:57 -0400, Lew Pitcher wrote:
Bit Twister wrote:
On Thu, 28 Jun 2018 17:25:39 -0400, Lew Pitcher wrote:
Bit Twister wrote:
On Sat, 23 Jun 2018 22:06:57 -0700, tom wrote:
On Sat, 23 Jun 2018 18:46:10 -0700 (PDT)
tracedynamics@gmail.com wrote:
On Tuesday, June 23, 1998 at 3:00:00 AM UTC-4, Rodney Mach wrote: >>>>>>> > What is the best way to run a job on the last day of
every month?
<snip>
Yeah but he asked how to do it in Cron. I am curious as well.
Sounds easy to me. Put a script in cron daily and use the calendar
program to get last day of month and compare with current day of
month. If current day is not last day exit. Suggested reading:
man date
man cal
man test
For example:
#!/bin/bash
Current_Day_of_Month=$(date '+%_d')
Last_Day_of_Month=$(set $(cal);shift $(( $# - 1));echo $1)
if [ $Current_Day_of_Month -ne $Last_Day_of_Month ] ; then
exit 0
fi
code for last day of month goes here
Alternatively....
#!/bin/bash
# If tomorrow is the 1st of the month,
# then today is the last day of the month
[ $(date +%-d -d tomorrow) != 1 ] && exit 0
# code for last day of the month goes here
Cute. I like it. I wish I could think like that.
It may be possible (should be possible, but I've never tried it) to
incorporate this test directly into the crontab entry, rather than
requiring the crontab entry to run a shell script.
Something like
1 0 28-31 * * [ $(date +%-d -d tomorrow) = 1 ] && do_this
where
do_this
is the path to the executable to be executed on the last day of the
month.
Personally, I do not want to mess with crontab.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 475 |
Nodes: | 16 (2 / 14) |
Uptime: | 85:26:26 |
Calls: | 9,501 |
Files: | 13,624 |
Messages: | 6,126,693 |