- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - HP-UX
- >
- System Administration
- >
- Log rotation daily
-
- Forums
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- OEM Solutions
- Servers: The Right Compute
- Shifting to Software-Defined
- Telecom IQ
- Transforming IT
- Infrastructure Solutions German
- L’Avenir de l’IT
- IT e Trasformazione Digitale
- Enterprise Topics
- ИТ для нового стиля бизнеса
- Blogs
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Forums
-
Blogs
-
InformationEnglish
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2009 07:13 PM
12-02-2009 07:13 PM
Log rotation daily
I would like to do a daily log rotation for the script attached. Anyone can help ?
Regards
Feng Lin
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2009 07:26 PM
12-02-2009 07:26 PM
Re: Log rotation daily
We can use cron.
# crontab -e
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2009 07:29 PM
12-02-2009 07:29 PM
Re: Log rotation daily
The current script just run a single file and keeps appending to the same file daily.
It is not producing a daily file itself. That is what I intend to do.
Regards
Feng Lin
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2009 07:41 PM
12-02-2009 07:41 PM
Re: Log rotation daily
log_file=log_`date +%Y%m%d%H%M`_readSMS.txt
So this says that everytime the script runs, it will produce a new file like log_200912022232_readSMS.txt.
So, if you do not want new file to be created, you should remove `date +%Y%m%d%H%M` above.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2009 07:55 PM
12-02-2009 07:55 PM
Re: Log rotation daily
The objective is, Once the script runs, it produces a daily logfile. The logfile logrotates every day with the timestamp. There is no interference manually. Currently, the file just keeps on appending to the file produced.
FYI,the process is meant to run 24*7.
Do you get what I mean?
Regards
Feng Lin
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2009 08:46 PM
12-02-2009 08:46 PM
Re: Log rotation daily
You will have to restart the java process daily so that the line:
log_file=log_`date +%Y%m%d%H%M`_readSMS.txt
be effective.
otherwise, the system will continue logging to the same file as at the date/time it was launched.
If not feasible, you will have to write another script that backups the log file and truncates the current one.
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-04-2009 12:56 AM
12-04-2009 12:56 AM
Re: Log rotation daily
read this URL:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1259916930385+28353475&threadId=1326387
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-04-2009 08:48 AM
12-04-2009 08:48 AM
Re: Log rotation daily
OUTFILE=/path/to/logs/log_$(date +%Y%m%d%H%M)
after that run your app like this:
if [ "$my_process" = "" ]
then
nohup java $JAVA_JVM -Xms128m \
-Xmx128m -verbose:gc -XX:PermSize=64m \
-XX:MaxPermSize=64m -XX:SurvivorRatio=6 \
com.nsp.sms.batch.ReadSMSBatch \
1>> ${OUTFILE} 2>> ${OUTFILE} &
fi
...but you need to start it over every day to refresh the value of the variable $OUTFILE
Unix operates with beer.
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2019 Hewlett Packard Enterprise Development LP