- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Configuration files
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
Forums
Discussions
Discussions
Discussions
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
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
10-21-2001 11:42 PM
10-21-2001 11:42 PM
Configuration files
I have to develop the script like this...
suppose i declared an Environment variable in HP-Unix like
# test=database.props
(database.props is the property file)
In that "database.props" file i have the content like this.
# vi database.props
FILE_NAME=cdr (cdr is the extension of the file)
RETAIN_PEND=10 (assumption is 10 days)
BACK_FILE_EXT=_x ( _x is the extension ends with the filename)
RETAIN_SEND=3 (Assumption is 3 days)
DB_
DB_
DB_
DB_
DB_
DB_
DB_
etc...........
---------------------------------------------------------------------------
Note1:
------
The file name which ends with "cdr" should be read from the 'FILE_NAME' and it should be deleted based on the "RETAIN_PEND" value..
Note2:
-------
The file name which ends with "_x" should be read from the 'BACK_FILE_EXT' and it should be deleted based on the "RETAIN_PEND" value..
Note3:
--------
To delete the file we should search for the files which is available from the "DB_" parameter.Because there will be so many product_id's starting with "DB_=/
Note4:
--------
The Error status of the files should be written to "syslog" using "Logger" Command in the
Is it possible to delete the file like this..Can any one can help me
Note5:
--------
I have attached sample script which delete the files for every 3 days(hardcoded) based on the directory specified in the Environment variable..
This script i recieved from the FAQ
Thanks for the advance in help...
Thanks & regards
Rajkuma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 12:46 AM
10-22-2001 12:46 AM
Re: Configuration files
Can anyone can provide a script for the above requirement..Its urjent please
Thanks
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 02:04 AM
10-22-2001 02:04 AM
Re: Configuration files
System's a bit slow today, but try the following:
==========================================
#!/bin/ksh
. ~/database.props
set | grep DB_ | cut -d= -f2 | while read DIR ; do
if [ ! -d "$DIR" ] ; then
logger "$0 : $DIR not found"
fi
COUNT=0
find $DIR -name "*${FILE_NAME}" -mtime +${RETAIN_PEND} | while read FILE ;
rm $FILE && logger "$0 : for directory $DIR, $FILE deleted"
COUNT=$(expr $COUNT + 1)
done
find $DIR -name "*${BACK_FILE_EXT}" -mtime +${RETAIN_SEND} | while read FILE ;
rm $FILE && logger "$0 : for directory $DIR, $FILE deleted"
COUNT=$(expr $COUNT + 1)
done
if [ "$COUNT" -gt 0 ] ; then
logger "$0 : for directory $DIR, $COUNT files removed"
else
logger "$0 : for directory $DIR, no matching files found"
fi
done
exit 0
=========================================
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 03:00 AM
10-22-2001 03:00 AM
Re: Configuration files
Thank you very much for your reply robin.Yes system is very slow today..
I have some queries in the program...
1)
You have mentioned . ~/database.props in the beginning of the file..That means are you reading it from the environment Variable 'TEST' ? Because that "database.props" is not a constant file..User may change it tomorrow..So we have to read it from the environment variable...Is it possible to do it in that way..?? That property file should not be hardcoded...
2)
set | grep DB_ | cut -d= -f2 | while read DIR ; do
In HP_Unix can we use "SET" while declaring the enviroment variable??? Because in sunSolaris we can declare like that..but In HP is it possible...???
Thanks & Regards
Rajkuma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 04:06 AM
10-22-2001 04:06 AM
Re: Configuration files
I forgot to tell you that database.props file will be available in the another environment variable..
GW_GEN_CONFIG_DIR
=/gateway/config
TEST=DATABASE.PROPS
Waiting for your reply..
Thanks & regards
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 05:12 AM
10-22-2001 05:12 AM
Re: Configuration files
If you want to run this through cron, you'll need to specify this external file somewhere other than in an environment variable so that the script can source it. Is the GW_GEN_CONFIG_DIR fixed - can it be hardcoded in the script, and therefore used to find the location of the db_props file?
The set command you are probably talking about is the csh command that is used to set variables. The set I have used in the script is to output the current list of variables so that I can search for those starting "DB_".
System is getting slower by the hour, don't know if it's me or not.
Rgds, Robi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 05:02 PM
10-22-2001 05:02 PM
Re: Configuration files
Thank you for your reply..
A)
GW_PIMEIUP_PROPERTY_FILE=
This is nothing but a propertyfile.This name is not static.Tomorrow it may change.so we have to read this "GW_PIMEIUP_PROPERTY_FILE=" to get the property file name..
For eg:
GW_PIMEIUP_PROPERTY_FILE - Environment variable...
B)
GW_GEN_CONFIG_DIR=
This is the environment variable where all the property files are stored.This is static.This directory name is fixed.
for eg:
GW_GEN_CONFIG_DIR - Environment variable...
In " DB_
Waiting for your response..
Thanking you..
Regards
Rajkuma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 11:28 PM
10-22-2001 11:28 PM
Re: Configuration files
The problem is that you want to run this through cron. You cannot set an environment variable in your shell, and expect cron to know about it. That is why I think you will have to use a file containing the location of your data.
What causes the property file to change? Can this change not automatically update the config file?
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 11:40 PM
10-22-2001 11:40 PM
Re: Configuration files
Its working fine..Thanks you..
In the property file "database.props" we are taking
these parameters..
FILE_NAME=CDR
BACK_FILE_EXT=_x
RETAIN_SEND=3
RETAIN_PEND=5
BAC_FILE001=
BAC_FILE002=
This way its working fine..
Till now we are deleting the files ending with "_x" along with CDR extention.Is it possible to delete the files starting with " x_" along with CDR ??
--"BACK_FILE_EXT=_x"
BACK_FILE_EXT=x_ ?????
Waiting for your reply...
Regards
Rajkuma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 11:46 PM
10-22-2001 11:46 PM
Re: Configuration files
Why not define any path/variable/whatever that it may change in the future at the beginning of the script? When you will change the name of the path/variable/whatever, you will surely remember to modify in only one more place, in the script. It's not that hard. Using environment variables is not working very well whilst using cron.
E.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 11:50 PM
10-22-2001 11:50 PM
Re: Configuration files
define in database.props another variable, let's say BACK_FILE_PRE=x_
replace the line from Robins' script
find $DIR -name "*${BACK_FILE_EXT}" -mtime +${RETAIN_SEND} | while read FILE ;
with
find $DIR -name "${BACK_FILE_PRE}*" -mtime +${RETAIN_SEND} | while read FILE ;
should work.
E.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2001 11:59 PM
10-22-2001 11:59 PM
Re: Configuration files
Yes you are correct..I will work in that way..The problem is suppose..
BAC_FILE001=/test1
BAC_FILE002=/test2
In this directories i created a files as per my Requirement..When i execute it its working fine..if i wont create any files in the test2 directory..The files are not deleting even though the files are in test1....If the files is in two directories its working..
What could be the reason???
Thanks
rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2001 12:30 AM
10-23-2001 12:30 AM
Re: Configuration files
Well, you changed your mind again.
DB_name or BAC_name? Please decide. If you want to use BAC, replace
set | grep DB_ | cut -d= -f2 | while read DIR ; do
with
set | grep BAC_ | cut -d= -f2 | while read DIR ; do
E.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2001 01:04 AM
10-23-2001 01:04 AM
Re: Configuration files
I was mistakenly used BAC_ instead of DB_
Can you please tell me the above previous reason???
Thanking you
Regards
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2001 01:31 AM
10-23-2001 01:31 AM
Re: Configuration files
The reason might be that the files are not 3 days old. For testing purposes, you either remove the +mtime condition on the find statement or you use touch to change the timestamps on the files.
E.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2001 03:54 AM
10-23-2001 03:54 AM
Re: Configuration files
I have created the same files in the /test1 /test2 directories using the touch command...Still it was like that only..
What could be the reason??
Thanks
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2001 04:38 AM
10-23-2001 04:38 AM
Re: Configuration files
Can you shows us the current script/config files that you're testing against. Also can you do an "ls -l" of the files in your test area?
Thanks, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2001 04:38 AM
10-23-2001 04:38 AM
Re: Configuration files
(man touch)
touch 10150000 /
that will change the date on the file to 15th of Oct and the time to 00:00.
then try the script. should work.
E.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2001 04:11 PM
10-23-2001 04:11 PM
Re: Configuration files
Great.Its working fine..
Thanks...
Regards
Raj