CPUG

The Check Point User Group

A Resource For The Check Point Community.  Fast.  Useful.  Independent.

1. CCSA/CCSE One-Week Dual-Certification Training Course with CPUG in San Francisco!
    Courses Starting 10/6, 11/3, 12/8, (2009) 1/19, 2/9, 3/9, 4/6, 5/4, 6/8, 7/6, 8/3, 9/7.
2. Corrent S3500 SecureXL Turbocards For Sale - Last Six Remaining - Get Your Spares!
3. Join Us On LinkedIn - We now have a CPUG group.


Go Back   CPUG: The Check Point User Group > Check Point Firewall-1/VPN-1 Platforms > Check Point SecurePlatform (SPLAT)
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2006-04-06
ChrisA ChrisA is offline
Senior Member
 
Join Date: 2006-02-18
Posts: 102
Rep Power: 3
ChrisA has an average reputation (10+)
Default Sendmail command in cron script in SPLat

In NGX on the SPLat SmartCenter server, we have a script that FTPs our logs and writes the output to a /tmp/FTPlog.out file. At the end of the script we have a sendmail command:

more /tmp/FTPlog.out | /opt/CPsuite-R60/fw1/bin/sendmail -s CPTMGT-LogArchive emailacct@xxx.com

This script works great when it is invoked manually and I get the email, but when it executes via cron, then the script works but I don't get the email.

Does anyone know why sendmail does not work with cron? The first line of the script is: #!/bin/bash -x

Thanks.
Reply With Quote
  #2 (permalink)  
Old 2006-04-07
kva.kva kva.kva is offline
Senior Member
 
Join Date: 2006-01-26
Location: Moscow, Russia
Posts: 706
Rep Power: 3
kva.kva has an average reputation (10+)
Default Re: Sendmail command in cron script in SPLat

Do you have some information about cron in /var/log/messages?
Reply With Quote
  #3 (permalink)  
Old 2006-04-07
ChrisA ChrisA is offline
Senior Member
 
Join Date: 2006-02-18
Posts: 102
Rep Power: 3
ChrisA has an average reputation (10+)
Default Re: Sendmail command in cron script in SPLat

There isn't anything in /var/log/messages to indicate a problem:

Mar 23 00:45:00 cpt-mgt CROND[8425]: (root) CMD (/usr/SCRIPTS/FTPlog.sh)
Mar 24 00:45:00 cpt-mgt CROND[28118]: (root) CMD (/usr/SCRIPTS/FTPlog.sh)
Reply With Quote
  #4 (permalink)  
Old 2006-04-07
kva.kva kva.kva is offline
Senior Member
 
Join Date: 2006-01-26
Location: Moscow, Russia
Posts: 706
Rep Power: 3
kva.kva has an average reputation (10+)
Default Re: Sendmail command in cron script in SPLat

edit your script
more /tmp/FTPlog.out | /opt/CPsuite-R60/fw1/bin/sendmail -s CPTMGT-LogArchive emailacct@xxx.com 1>/tmp/scr.log 2>&1

and after execution script check file /tmp/scr.log
Reply With Quote
  #5 (permalink)  
Old 2006-04-07
ChrisA ChrisA is offline
Senior Member
 
Join Date: 2006-02-18
Posts: 102
Rep Power: 3
ChrisA has an average reputation (10+)
Default Re: Sendmail command in cron script in SPLat

Here's what shows up in the scr.log file:

/opt/CPsuite-R60/fw1/bin/sendmail: error while loading shared libraries: libcppr
od50.so: cannot open shared object file: No such file or directory
Reply With Quote
  #6 (permalink)  
Old 2006-04-07
chillyjim chillyjim is offline
Senior Member
 
Join Date: 2005-08-29
Location: Upstate NY
Posts: 1,648
Rep Power: 5
chillyjim has an average reputation (10+)
Send a message via AIM to chillyjim Send a message via Skype™ to chillyjim
Default Re: Sendmail command in cron script in SPLat

I doubt this is the problem but try it with "cat" instead of "more".

Also make sure the cron job is running as admin or someother defined user and not root. You want to make sure you get the correct environment. (your ldlibiarypath (sp?) might well be wrong).
Reply With Quote
  #7 (permalink)  
Old 2006-04-07
ChrisA ChrisA is offline
Senior Member
 
Join Date: 2006-02-18
Posts: 102
Rep Power: 3
ChrisA has an average reputation (10+)
Default Re: Sendmail command in cron script in SPLat

The problem is resolved, though I may have resolved it the wrong way (?)

When I was logged into the SPLat box as admin, I did: echo $LD_LIBRARY_PATH

I took that info and used the export command in the script to set the same variable:

export LD_LIBRARY_PATH='/opt/spwm/lib:/opt/CPshrd-R60/lib:/opt/CPsuite-R60/fw1/lib:/opt/CPsuite-R60/fg1/lib:/opt/CPportal-R60/webis/lib:/opt/CPportal-R60/portal/lib':$LD_LIBRARY_PATH

It works like a charm. Does anyone see a problem with doing this?
Reply With Quote
  #8 (permalink)  
Old 2006-04-07
chillyjim chillyjim is offline
Senior Member
 
Join Date: 2005-08-29
Location: Upstate NY
Posts: 1,648
Rep Power: 5
chillyjim has an average reputation (10+)
Send a message via AIM to chillyjim Send a message via Skype™ to chillyjim
Default Re: Sendmail command in cron script in SPLat

No problem with this at all. About the only thing you might want to do is narrow down the path.
Reply With Quote
  #9 (permalink)  
Old 2006-04-08
kva.kva kva.kva is offline
Senior Member
 
Join Date: 2006-01-26
Location: Moscow, Russia
Posts: 706
Rep Power: 3
kva.kva has an average reputation (10+)
Default Re: Sendmail command in cron script in SPLat

You do correct. For crontab's scripts you need sometimes to export some variables.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 01:38.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0