- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script to count files on daily basis
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
тАО07-15-2015 12:41 PM
тАО07-15-2015 12:41 PM
Re: script to count files on daily basis
Patrick
your second script worked fine, but I need to mail that output to an email address
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-15-2015 12:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-15-2015 12:49 PM
тАО07-15-2015 12:49 PM
Re: script to count files on daily basis
> [...] but I need to mail that output to an email address
What's stopping you? Did you try a Forum (or Web) search for, say:
e-mail from shell script hp-ux
???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-15-2015 01:04 PM
тАО07-15-2015 01:04 PM
Re: script to count files on daily basis
Thanks a lot, I knew that I needed to use mailx, but I was not sure how because of the requirement to display 2 outputs. But thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2015 01:23 AM
тАО08-03-2015 01:23 AM
Re: script to count files on daily basis
Hi
for some reason and since 31st of july, the script is providing erroneous output:
#!/usr/bin/sh # Get yesterdays date YESTMON=$(perl -MPOSIX -le '@t=localtime;--$t[3];print strftime "%Y %b %d",@t' | awk '{print $2}') YESTDAY=$(perl -MPOSIX -le '@t=localtime;--$t[3];print strftime "%Y %b %d",@t' | awk '{print $3}') CDRCOUNT=$(ls -lrt *.cdr | awk '{if (($6 == "'${YESTMON}'") && ($7 == "'${YESTDAY}'")) print $0}' | wc -l) TAPCOUNT=$(ls -lrt *.tap | awk '{if (($6 == "'${YESTMON}'") && ($7 == "'${YESTDAY}'")) print $0}' | wc -l) echo "cdr: ${CDRCOUNT}" echo "tap: ${TAPCOUNT}"
and the output is:
cdr: 0 tap: 0
can you help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2015 12:12 AM
тАО08-04-2015 12:12 AM
Re: script to count files on daily basis
>for some reason and since 31st of july, the script is providing erroneous output:
What part isn't working?
Add: echo "Yesterday: $YESTMON|$YESTDAY"
As far as I can tell, this never worked during the first 9 days of a month.
You need to do a numeric compare:
CDRCOUNT=$(ls -l *.cdr | awk 'BEGIN {sum = 0} $6 == "'${YESTMON}'" && $7 ==
'${YESTDAY}' {++sum} END {print sum}')
TAPCOUNT=$(ls -l *.tap | awk 'BEGIN {sum = 0} $6 == "'${YESTMON}'" && $7 ==
'${YESTDAY}' {++sum} END {print sum}')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2015 12:38 AM
тАО08-04-2015 12:38 AM
Re: script to count files on daily basis
when adding echo "Yesterday: $YESTMON|$YESTDAY"
the result is:
Yesterday: Aug|03
and when changing with the piece of code you suggested, it does come right:
cdr: 1608 tap: 194
and if I place the script under a different directory and modify the script acordingly:
CDRCOUNT=$(ls -lrt /data/ICTPRD/bmd1/rating/processed/*.cdr | awk 'BEGIN {sum = 0} $6 == "'${YESTMON}'" && $7 == '${YESTDAY}' {++sum} END {print sum}') TAPCOUNT=$(ls -lrt /data/ICTPRD/bmd1/rating/processed/*.tap | awk 'BEGIN {sum = 0} $6 == "'${YESTMON}'" && $7 == '${YESTDAY}' {++sum} END {print sum}')
produces the following results:
./contar[12]: /usr/bin/ls: The parameter list is too long. cdr: 0 tap: 194
So...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2015 03:59 AM
тАО08-04-2015 03:59 AM
Re: script to count files on daily basis
>if I place the script under a different directory and modify the script accordingly:
"accordingly" means you have to handle mass quantities, which means you need to use find, not ll(1).
Or you can use this bandaid:
CDRCOUNT=$(cd /data/ICTPRD/bmd1/rating/processed; ls -lrt *.cdr | awk 'BEGIN {sum = 0} $6 == "'${YESTMON}'" && $7 == '${YESTDAY}' {++sum} END {print sum}')
TAPCOUNT=$(cd /data/ICTPRD/bmd1/rating/processed; ls -lrt *.tap | awk 'BEGIN {sum = 0} $6 == "'${YESTMON}'" && $7 == '${YESTDAY}' {++sum} END {print sum}')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-04-2015 05:29 AM
тАО08-04-2015 05:29 AM
Re: script to count files on daily basis
thanx a lot, already assigned kudos
- « Previous
-
- 1
- 2
- Next »