- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Not receiving email when run through cron in l...
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
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
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
10-17-2018 12:35 AM
10-17-2018 12:35 AM
Not receiving email when run through cron in linux server, but receiving when run manually.How do we
Hi All,
We are running a shell script on linux using the root user.
The functionality of the shell script is to check whether the tomcat process is running on the linux server and send an email if it is running or not running.
mailx -s "subject" emailid < /dev/null is what is being used to send email.
The emailid above is taken from environment setting file
We are receiving the email when we run the script manually but not when it is run through crontab.
Went to /etc/crontab and have initialised the EMAILTO option to our email ids..
When we check the /var/mail/root file after the cron is run, we see the message that the "Recepients emails are not specfied "
Same is the case when we schedule through normal user. Please suggest the way forward..
- Tags:
- crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2018 06:17 AM
10-17-2018 06:17 AM
Re: Not receiving email when run through cron in linux server, but receiving when run manually.How d
> mailx -s "subject" emailid < /dev/null is what is being used to send
> email.
No, it's not. What is the _actual_ command in the script?
> The emailid above is taken from environment setting file
You wish. Which "environment setting file"? How is it read?
> Went to /etc/crontab and have initialised the EMAILTO option to our
> email ids..
What does that mean? As usual, showing actual actions with their
actual results (error messages, ...) can be more helpful than vague
descriptions or interpretations. What you actually did is much more
important than what you think it all means.
A "cron" job runs in an environment different from that of an
interactive job. You may believe that you're setting some environment
variable somewhere, but, without seeing any of your actual code, I'd
guess that your "cron" job sees none of it.
> When we check the /var/mail/root file after the cron is run, we see
> the message that the "Recepients emails are not specfied "
Which would be consistent with that "emailid" not really being
defined. For a good time, throw something like "echo emailid" into your
script, and see what its value really is when the script runs.
If there's a script-like file somewhere which defines some variable,
then you may need to read it explicitly in your "cron" script:
. /path/to/file