- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: scripting help
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
05-11-2002 05:45 PM
05-11-2002 05:45 PM
I am trying to figure out how to take a script and make it peruse the syslog file and dmesg file plus other error logs for errors and put them into a single file, (THIS PART OF THE TASK IS NOT TOO DIFFICULT), The 2nd part of the equation is to take each of these files and FTP them from each system to one central system so that I can then combine all of the files into one single file to be emailed daily as a system error message file for all systems. I was wondering how to work the FTP from one system coding this part of it is driving me nuts. I was wondering if anyone might have some code that does FTP from each system and brings it back to one central point, i figure that I have to factor in being able to code the root password or equivelent password to be able to allow FTP to log in to the system. Just for information, ALL systems in our domain have the ability to FTP to each other. So if someone has an idea please let me know. Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2002 07:20 PM
05-11-2002 07:20 PM
Solutiongrep -i -e warn -e err -e fail -e serious /var/adm/syslog/syslog.log
For batch FTP, use the 'here' document technique:
#!/usr/bin/sh
set -u
export PATH=/usr/bin
DEST=12.34.56.78
USER=ftpuser
PW=somepassword
LOCALCD=/var/temp/special
REMOTECD=/var/temp/collector
MYFILE=
ftp -n -v $DEST << EOF
user $USER $PW
binary
lcd $LOCALCD
cd $REMOTECD
put $MYFILE
chmod 600 $MYFILE
EOF
root password? Totally unnecassary and a big security risk. Send and receive your logfiles as an ordinary user (ie, ftpuser for instance). This script must be 700 permission so no one except ftpuser can read or write it.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2002 05:30 AM
05-12-2002 05:30 AM
Re: scripting help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2002 07:10 AM
05-12-2002 07:10 AM
Re: scripting help
the here- technique means, he uses a different EOF ("End of file") than the default. Let's explain with the mail- command:
normally:
mail user@host (return)
text (return)
text (return)
ctrl-d
the ctrl-d combinations is the signal for the mail-command that his input is now over. Here- technique would be:
mail user@host << EOF (return)
text (return)
text (return)
EOF
<< ----> tells your command, not to use the normal end of file- combination. (configurable over stty-command)
EOF ----> tells the command, for what to look instead. Here you can also write something else, but you have to take care, that your EOF- marker is a single word at the beginning of a line to get it work.
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2002 11:29 PM
05-12-2002 11:29 PM
Re: scripting help
Do you know the file .netrc?
Please read man netrc.
Hope this helps,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2002 12:04 AM
05-13-2002 12:04 AM
Re: scripting help
You can do all you want and lots more besides by using big brother. http://www.bb4.com/
And if you want to know about "here documents", try
http://www.tldp.org/LDP/abs/html/here-docs.html
or HPs own shell users guide at
http://docs.hp.com/hpux/onlinedocs/B2355-90046/B2355-90046.html
Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2002 04:56 AM
05-13-2002 04:56 AM
Re: scripting help
You can use tail -f
tail -f /var/adm/syslog/syslog.log |remsh topaz "cat - > /tmp/xantia 2>&1"&
This reads my syslog as it is filled up and writes a copy on machine topaz in /tmp/machine
Like this you can filter
tail -f /var/adm/syslog/syslog.log|while read line
do
echo $line|grep -i error
echo $line|grep -i warning
done|remsh topaz "cat - > /tmp/xantia 2>&1"
process stays open but avoids all the ftp opens and closes
Steve Steel