- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script HELP
Operating System - HP-UX
1752809
Members
5788
Online
108789
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
Discussions
Discussions
Forums
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
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-25-2010 10:13 AM
тАО03-25-2010 10:13 AM
I need script that send email when my ftpscript fail for some reason Now every thing work fine.
My Script search error from logs:
---------------------------------
#Move last LOG to OLD
mv /tmp/logschk.txt /tmp/logschk.txt.OLD
>/tmp/logschk.txt # Touch file LOG
-------------------------------------
#LOG env arch.
export LOG=/tmp/logschk.txt
-----------------------------
# env for my parent error search criterial (no such file etc...)
export ERRORES=/tmp/chkctrl.txt
------------------------------------------
# Find error w/match parten file and create result in LOG file
grep -f $ERRORES /tmp/ftp* 0>>$LOG
--------------------------------------
#Send email w/attach (logschk.txt attach name) with match errors to alias user call " test"
uuencode $LOG logschk.txt |mailx -s 'Falla FtpServicio' test
I made the above script to find and send some error ocurred if match with a parent file that I need verify. if this no match happen the script send a empty email.
I need send email only when some grep match with parent file other ways nothing happend.
rigth now all way send email but i need send when only have match with my parten file
Pls, a little help with my limited
Thsk every one.
My Script search error from logs:
---------------------------------
#Move last LOG to OLD
mv /tmp/logschk.txt /tmp/logschk.txt.OLD
>/tmp/logschk.txt # Touch file LOG
-------------------------------------
#LOG env arch.
export LOG=/tmp/logschk.txt
-----------------------------
# env for my parent error search criterial (no such file etc...)
export ERRORES=/tmp/chkctrl.txt
------------------------------------------
# Find error w/match parten file and create result in LOG file
grep -f $ERRORES /tmp/ftp* 0>>$LOG
--------------------------------------
#Send email w/attach (logschk.txt attach name) with match errors to alias user call " test"
uuencode $LOG logschk.txt |mailx -s 'Falla FtpServicio' test
I made the above script to find and send some error ocurred if match with a parent file that I need verify. if this no match happen the script send a empty email.
I need send email only when some grep match with parent file other ways nothing happend.
rigth now all way send email but i need send when only have match with my parten file
Pls, a little help with my limited
Thsk every one.
The time is gold
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-25-2010 11:15 AM
тАО03-25-2010 11:15 AM
Re: Script HELP
Hi:
One way is to test your '$LOG' file for a non-zero size:
if [ -s ${LOG} ]; then
uuencode ...
fi
...This test returns true only if the file exists and has a size greater than zero.
Regards!
...JRF...
One way is to test your '$LOG' file for a non-zero size:
if [ -s ${LOG} ]; then
uuencode ...
fi
...This test returns true only if the file exists and has a size greater than zero.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-26-2010 12:01 AM
тАО03-26-2010 12:01 AM
Solution
Hi,
you could:
------------------------------------------
# Find error w/match parten file and create result in LOG file
N_ERRORES=$(grep -c $ERRORES /tmp/ftp*)
if [[ $N_ERRORES > 0 ]]; then
grep -f $ERRORES /tmp/ftp* 0>>$LOG
#Send email w/attach (logschk.txt attach name) with match errors to alias user call " test"
uuencode $LOG logschk.txt |mailx -s 'Falla ($N_ERRORES) FtpServicio' test
fi
in this way you will have the number of the error in the subject of the mail as well.
HTH,
Art
you could:
------------------------------------------
# Find error w/match parten file and create result in LOG file
N_ERRORES=$(grep -c $ERRORES /tmp/ftp*)
if [[ $N_ERRORES > 0 ]]; then
grep -f $ERRORES /tmp/ftp* 0>>$LOG
#Send email w/attach (logschk.txt attach name) with match errors to alias user call " test"
uuencode $LOG logschk.txt |mailx -s 'Falla ($N_ERRORES) FtpServicio' test
fi
in this way you will have the number of the error in the subject of the mail as well.
HTH,
Art
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP