1827203 Members
2659 Online
109716 Solutions
New Discussion

Company holidays?

 
SOLVED
Go to solution

Company holidays?

Hello experts:

Is there a file or a table that stores company holidays on the system? If so how do you update it?

Thanks
Steve
8 REPLIES 8
Torsten.
Acclaimed Contributor

Re: Company holidays?

The system get never holidays!

(the question is more than unclear to me ...)

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Company holidays?

Well, conceivably there could be many files or database tables with these data on a given system but if you are asking is there a standard file for holidays on a UNIX system then the answer is "yes". The file is called (surprise) "holidays". You probably already have an /etc/acct/holidays file on your box and it probably hasn't been touched in years. It's a relic of the old system accounting system which is seldom used anymore. Most systems don't even have a man page for this file anymore. It's simply a textfile and can be maintained with a text editor. My dates scripts reference this file.
If it ain't broke, I can fix that.
Torsten.
Acclaimed Contributor

Re: Company holidays?

Wow - just learned something about holidays (thank's Clay).

# more /etc/acct/holidays
* Prime/Nonprime Table for HP-UX Accounting System
*
* Curr Prime Non-Prime
* Year Start Start
*
1998 0800 1700
*
* Day of Calendar Company
* Year Date Holiday
*
1 Jan 1 New Year's Day
47 Feb 16 Presidents' Day
100 Apr 10 Spring Holiday
145 May 25 Memorial Day
184 Jul 3 Independence Day
250 Sep 7 Labor Day
330 Nov 26 Thanksgiving Day
331 Nov 27 Day after Thanksgiving
359 Dec 25 Christmas

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
A. Clay Stephenson
Acclaimed Contributor

Re: Company holidays?

By the way, calculating those day offsets is rather easily done with caljd.sh. For example to calculate the offset of Christmas 2007:

1) Determine Julian Day of 12/31/Current_year - 1
$ caljd.sh 12 31 2006
2454101

2) Determine Julian Day of Xmas, 2007
$ caljd.sh 12 25 2007
2454460

3) Subtract 2) from 1) to get the offset for the holidays entry:
echo $(( 2454460 - 2454101))
359

My latest version of caljd.sh is Vrsn 2.23 s. You should have no trouble finding it.
If it ain't broke, I can fix that.
Sp4admin
Trusted Contributor

Re: Company holidays?

Hello Steve,

We also use the /etc/acct/hoilday files as Torsten does.

more holidays.2007
* Prime/Nonprime Table for HP-UX Accounting System
*
* Curr Prime Non-Prime
* Year Start Start
*
2007 0730 1600
*
* Day of Calendar Company
* Year Date Holiday
*
1 Jan 1 New Years Day
15 Jan 15 Martin Luther King Day
50 Feb 19 President's Day
148 May 28 Memorial Day
185 Jul 4 Independence Day
246 Sep 3 Labor Day
281 Oct 8 Columbus Day
316 Nov 12 Veterans Day
326 Nov 22 Thanksgiving
359 Dec 25 Christmas

Sp,

Re: Company holidays?

Thanks everyone! I now have my /etc/acct/holidays file up to date but I don't know how to use it. What I need to do is to run a script or program daily to find out if tomorrow is going to be a holiday so backups don't fail because nobody is here to change tapes. Any ideas?

I'll assign points to everyone later.

Thanks
Steve

A. Clay Stephenson
Acclaimed Contributor

Re: Company holidays?

I love it when people fail to ask the right question initially. Any child on the streets of Starkville could determine if tomorrow is a holiday:

if [[ $(caljd.sh -n 1) != $(caljd.sh -n 1 -h) ]]
then
echo "Tomorrow is a holiday!!!"
else
echo "It ain't."
fi

Now, /etc/acct/holidays only works on the current year so consider what might happen over a year boundary --- and 01-January is a common holiday. To deal with this problem, caljd.sh, uses this convention, it first looks for the file holidays_YYYY before holidays. On my systems, I symbolically link /etc/acct/holidays_2007 (or whatever is the current year) to /etc/acct/holidays.


Attached is the latest caljd.sh version, 2.3 s. Invode as caljd.sh -u for full usage and many examples.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: Company holidays?

Oh, and because Labor Day is just around the corner, you still may not be asking precisely the right question. What you may have meant, "is tomorrow a weekend or a holiday?" Caljd.sh can be told to skip weekends (or any days of the week) and holidays and report the next "working" day.

if [[ $(caljd.sh -n 1) != $(caljd.sh -n 1 -h -x 6 -x 0) ]]
then
echo "Tomorrow is a holiday or a weeked!!!"
else
echo "It ain't."
fi

The -x 6 and -x 0 says to exclude Saturdays and Sundays respectively.

If it ain't broke, I can fix that.