HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script problem with monitoring log file
Operating System - HP-UX
1833883
Members
1731
Online
110063
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
Go to solution
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
03-07-2003 07:23 AM
03-07-2003 07:23 AM
I have the following script on our ftp server. It monitors the syslog file and greps for RETR. Once this occurs, it changes the permissions on the file to prevent the file from being ftp'd again by the same user. The file names are listed in another file, and another cron job removes these files from the ftp server at certain times.
The script works fine if I initiate an internal ftp login and transfer a file (or several files). However, it does not work with when the file is ftp'd via the external ftp session. The syslog shows the exact same information for the external ftp as the internal ftp:
Mar 6 21:05:23 e25 ftpd[20981]: RETR /ehdl20030306115127
This script is running continuously in the background.
LOGFILE=/var/adm/syslog/syslog.log
tail -1f $LOGFILE |while read line
do
echo $line |grep RETR
if [ "$?" = 0 ]
then
#get file name and place in file
echo $line | cut -f7 -d " ">/opt/maestro/scripts/file_name.log
#read each filename with path
file_name=`cat /opt/maestro/scripts/file_name.log`
find /ftpdata/ftpusers -name $file_name -exec chmod 400 {} \;
find /ftpdata/ftpusers -name $file_name -exec chown ftpadmin:ftpadmin {} \;
find /ftpdata/ftpusers -name $file_name -print >>/opt/maestro/scripts/file.log
fi
done
Your help is greatly appreciated.
thanks
The script works fine if I initiate an internal ftp login and transfer a file (or several files). However, it does not work with when the file is ftp'd via the external ftp session. The syslog shows the exact same information for the external ftp as the internal ftp:
Mar 6 21:05:23 e25 ftpd[20981]: RETR /ehdl20030306115127
This script is running continuously in the background.
LOGFILE=/var/adm/syslog/syslog.log
tail -1f $LOGFILE |while read line
do
echo $line |grep RETR
if [ "$?" = 0 ]
then
#get file name and place in file
echo $line | cut -f7 -d " ">/opt/maestro/scripts/file_name.log
#read each filename with path
file_name=`cat /opt/maestro/scripts/file_name.log`
find /ftpdata/ftpusers -name $file_name -exec chmod 400 {} \;
find /ftpdata/ftpusers -name $file_name -exec chown ftpadmin:ftpadmin {} \;
find /ftpdata/ftpusers -name $file_name -print >>/opt/maestro/scripts/file.log
fi
done
Your help is greatly appreciated.
thanks
If at first you don't succeed, change the rules!
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 07:32 AM
03-07-2003 07:32 AM
Solution
Hi,
the log example shows the filename as:
/ehdl20030306115127
which indicates it is at the root of the file system. Yet your find is looking in another directory. Do you need to remove the leading "/" before saving the filename?
rgds, Robin
the log example shows the filename as:
/ehdl20030306115127
which indicates it is at the root of the file system. Yet your find is looking in another directory. Do you need to remove the leading "/" before saving the filename?
rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2003 08:40 AM
03-07-2003 08:40 AM
Re: script problem with monitoring log file
Hi Robin,
Thanks for your quick response. The problem appears to be that it's looking for the name "/ehdl...", with "/" as part of the name. If you hadn't pointed that line out, I would have never seen it!
I checked the syslog file and the internal ftp sessions has only the file name, while the external sessions have the "/", as a result of the "cut" command.
Thanks
Thanks for your quick response. The problem appears to be that it's looking for the name "/ehdl...", with "/" as part of the name. If you hadn't pointed that line out, I would have never seen it!
I checked the syslog file and the internal ftp sessions has only the file name, while the external sessions have the "/", as a result of the "cut" command.
Thanks
If at first you don't succeed, change the rules!
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