Sponsored Content
Top Forums Shell Programming and Scripting How to find the first day of previous month in unix? Post 302124749 by jim mcnamara on Monday 2nd of July 2007 11:59:46 AM
Old 07-02-2007
The datecalc script perderabo put in the FAQ section - the one section we keep asking you to read.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies

2. Shell Programming and Scripting

last working day of previous month

Hi, I want a script(ksh) to see if today is the last working day(Mon-Fri) of the month. If it is the last working day I need to print current date, else I need the last working day of previous month. Thanks in advance. (1 Reply)
Discussion started by: rspk_praveen
1 Replies

3. Shell Programming and Scripting

needs to display month for previous day date

Hello, I wanted to display the month for previous day date. Like, today date is 18-Nov-2008. So the previous date is 17-Nov-2008. The output should be November. If the today date is 1-DEC-2008, then output should be NOVEMBER. If the today date is 1-JAN-2008, then output should be DECEMBER.... (4 Replies)
Discussion started by: govindts
4 Replies

4. Shell Programming and Scripting

Display month for Previous day

Hello - I have one question regarding the date. I wanted to display the month name for previous day. The output should be as follows... 5-Feb-09 => February 1-Feb-09 => January 28-Feb-09=> February Here is the code i am using to get the output.... date '+%m %d %Y' | { read MONTH DAY... (4 Replies)
Discussion started by: govindts
4 Replies

5. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

6. Shell Programming and Scripting

How to find the first working day of month ?

Hi, How to find the first working day of month ? My requirement is, I need to call the function only if today is first working day of month. I could find out one function which finds last working day in month in this forum. Can anyone pls let me know for first working day. Thanks. for... (10 Replies)
Discussion started by: vnimavat
10 Replies

7. Shell Programming and Scripting

how to find the second business day of month

I want to decide is that today is larger than the second business day of this month, who can i find second business day of this month? (3 Replies)
Discussion started by: qjlongs
3 Replies

8. Programming

How to get First and Last day of previous month from trunc(sysdate)

Hi Guys, How to get First day of previous month and last day of previous month from trunc(sysdate) using SQL..? Thanks in advance. Br, pinpe (2 Replies)
Discussion started by: pinpe
2 Replies

9. Shell Programming and Scripting

Find Month first Working Day

Hi, I would like to calculate 1st working/Business day of each month. Exp: 1st -Oct-2011 is Saturday--- Non Business Day So the Next Working Day would be 3-Oct-2011 I need a shell script to calculate the month first business date. (3 Replies)
Discussion started by: koti_rama
3 Replies

10. Shell Programming and Scripting

How to find the date of previous day in shell script?

Hi Experts, i am using the below code get the date of previous day. #!/usr/bin/ksh datestamp=`date '+%Y%m%d'` yest=$((datestamp -1)) echo $yest When i execute the code i am getting output as: 20130715 What i am trying here is, based on the date passed i am fetching previus day's... (0 Replies)
Discussion started by: learner24
0 Replies
Ns_CritSec(3aolserver)					   AOLserver Library Procedures 				    Ns_CritSec(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
, Ns_CsDestroy, Ns_CsEnter, Ns_CsInit, Ns_CsLeave - Manage and use critical section locks SYNOPSIS
#include "ns.h" void Ns_CsDestroy(Ns_Cs *csPtr) void Ns_CsEnter(Ns_Cs *csPtr) void Ns_CsInit(Ns_Cs *csPtr) void Ns_CsLeave(Ns_Cs *csPtr) _________________________________________________________________ DESCRIPTION
Critical section locks are used to prevent more than one thread from executing a specific section of code at one time. They are implemented as "objects", which simply means that memory is allocated to hold the lock state. They can also be called "sychronization objects". While a thread is executing a critical section of code, all other threads that want to execute that same section of code must wait until the lock surrounding that critical section has been released. This is crucial to prevent race conditions which could put the server into an unknown state. For example, if a section of code frees a pointer and then decrements a counter that stores how many pointers exist, it is possible that the counter value and the actual number of pointers may be different. If another section of the server relies on this counter and reads it when the pointer has been freed, but the counter has not yet been decremented, it could crash the server or put it into an unknown state. Critical section locks should be used sparingly as they will adversely impact the performance of the server or module. They essentially cause the section of code they enclose into behaving in a single-threaded manner. If a critical section executes slowly or blocks, other threads that must execute that section of code will begin to block as well until the critical section lock is released. You will normally want to wrap sections of code that are used to both read and write values, create and destroy pointers and structures or otherwise look at or modify data in the system. Use the same named lock for both read and write operations on the same data. Threads that are waiting for a critical section lock to be released do not have to poll the lock. The critical section lock functions use thread condition functions to signal when a lock is released. Ns_CsDestroy(csPtr) Destroy a critical section object. Note that you would almost never need to call this function as synchronization objects are typi- cally created at startup and exist until the server exits. The underlying objects in the critical section are destroyed and the critical section memory returned to the heap. Ns_CsEnter(csPtr) Lock a critical section object, initializing it first if needed. If the critical section is in use by another thread, the calling thread will block until it is no longer so. Note that critical sections are recursive and must be exited the same number of times as they were entered. Ns_CsInit(csPtr) Initialize a critical section object. Memory will be allocated to hold the object's state. Ns_CsLeave(csPtr) Unlock a critical section once. A count of threads waiting to enter the critical section is kept, and a condition is signaled if this is the final unlock of the critical section so that other threads may enter the critical section. SEE ALSO
nsd(1), info(n), Ns_MasterLock(3), Ns_MasterUnlock(3), Ns_CondDestroy(3), Ns_CondSignal(3), Ns_CondWait(3), Ns_MutexLock(3), Ns_MutexUn- lock(3) KEYWORDS
AOLserver 4.0 Ns_CritSec(3aolserver)
All times are GMT -4. The time now is 09:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy