HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Please Help with small Script
Operating System - HP-UX
1835658
Members
3508
Online
110082
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
08-18-2004 11:19 AM
08-18-2004 11:19 AM
Please Help with small Script
Can someone please help me with something real basic? I don't have much experience with scripting. I need to determine whether some files exist on the systems or not and have all of the results write out to a file named 29_XXXXXXXX.
I am stumped and this is how far I've gotten.
Thanks - Angie
echo "Item #29 -- Determine if various log files exist."
if [ ! -d /etc/wtmpx]; then
echo wtmpx file doesn't exist > 29_wtmpx
# /etc/utmpx \
# /var/adm/utmpx \
# /var/adm/loginlog \
# /var/adm/sulog \
# /var/adm/messages \
# /var/cron/log \
# /var/log/syslog \
I am stumped and this is how far I've gotten.
Thanks - Angie
echo "Item #29 -- Determine if various log files exist."
if [ ! -d /etc/wtmpx]; then
echo wtmpx file doesn't exist > 29_wtmpx
# /etc/utmpx \
# /var/adm/utmpx \
# /var/adm/loginlog \
# /var/adm/sulog \
# /var/adm/messages \
# /var/cron/log \
# /var/log/syslog \
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2004 11:33 AM
08-18-2004 11:33 AM
Re: Please Help with small Script
With scrpting, you can do the same thing in umpteen differen ways :-)
Here is the one version
1) Create a file that lists all the log files that you would like to check for
# vi /usr/local/bin/LOGFLLIST
/etc/utmpx
/var/adm/utmpx
/var/adm/loginlog
/var/adm/sulog
/var/adm/messages
/var/cron/log
/var/log/syslog
#
2) Now the script
# vi /usr/local/bin/script
LIST=/usr/local/bin/LOGFLLIST
OUTLOG=/usr/local/bin/29_output
echo "Item #29 -- Determine if various log files exist."
for FILE in $(cat ${LIST})
do
if [[ -f $FILE ]]
then
echo "Log file ${FILE} exists !" >> $OUTLOG
else
echo "ERROR: Log file ${FILE} doesnt exists !" >> $OUTLOG
fi
done
-- Sundar
Here is the one version
1) Create a file that lists all the log files that you would like to check for
# vi /usr/local/bin/LOGFLLIST
/etc/utmpx
/var/adm/utmpx
/var/adm/loginlog
/var/adm/sulog
/var/adm/messages
/var/cron/log
/var/log/syslog
#
2) Now the script
# vi /usr/local/bin/script
LIST=/usr/local/bin/LOGFLLIST
OUTLOG=/usr/local/bin/29_output
echo "Item #29 -- Determine if various log files exist."
for FILE in $(cat ${LIST})
do
if [[ -f $FILE ]]
then
echo "Log file ${FILE} exists !" >> $OUTLOG
else
echo "ERROR: Log file ${FILE} doesnt exists !" >> $OUTLOG
fi
done
-- Sundar
Learn What to do ,How to do and more importantly When to do ?
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP