- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Cron.d and Email
Operating System - Linux
1821640
Members
3235
Online
109633
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
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
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
тАО10-17-2010 05:48 PM
тАО10-17-2010 05:48 PM
Cron.d and Email
I have a linux box trying with a script that runs a report, creates a log then emails it.
Sendmail appears to be working fine as I can run simple "mail" commands and get emails. I have another perl script that emails and it works fine. I did not create either but inherited them.
I simply added a 0, and ,20 to get to 0.7,19,20 hours added the to emails
The Cron.d job is located in the following location and rights.
[admin@RM1CS0AH0368 ~]$ cd /etc/cron.d
[admin@RM1CS0AH0368 cron.d]$ ll
total 4
lrwxrwxrwx 1 root root 24 Apr 30 12:45 nas_sys -> /nas/site/cron.d/nas_sys
lrwxrwxrwx 1 root root 25 Apr 30 12:45 nas_user -> /nas/site/cron.d/nas_user
-rw-r--r-- 1 root root 188 Apr 7 2006 sysstat
The nas_user file is as follows:
[root@RM1CS0AH0368 cron.d]# cat nas_user
0 0 * * 0 nasadmin /nas/bin/server_date server_2 timezone -name America/Chicago >&/dev/null
0 0 * * 0 nasadmin /nas/bin/server_date server_3 timezone -name America/Chicago >&/dev/null
0 0 * * 0 nasadmin /nas/bin/server_date server_4 timezone -name America/Chicago >&/dev/null
20 7,19 * * * nasadmin /home/nasadmin/email/savvol_email 90 >/home/nasadmin/email/sv_cron.log 2>&1
30 0,7,19,20 * * * nasadmin /home/nasadmin/email/repreport|/usr/sbin/sendmail -t >/home/nasadmin/email/repreport.log 2>&1
The script file is located in /home/nasadmin/email
repreport which has the following Contents:
printf "%s\n%s\n\n" "To:rustyfeo2@yahoo.com" "Subject:REP RM1 LONG FS Flight Status";
export NAS_DB=/nas;
/nas/bin/nas_replicate -i -a
Here is my question: if I edit the file under the folder /etc/cron.d/nas_user, do I have to restart the crond daemon?
/sbin/service crond restart
Also, what is the printf "%s\n%s\n\n" saying?
Sendmail appears to be working fine as I can run simple "mail" commands and get emails. I have another perl script that emails and it works fine. I did not create either but inherited them.
I simply added a 0, and ,20 to get to 0.7,19,20 hours added the to emails
The Cron.d job is located in the following location and rights.
[admin@RM1CS0AH0368 ~]$ cd /etc/cron.d
[admin@RM1CS0AH0368 cron.d]$ ll
total 4
lrwxrwxrwx 1 root root 24 Apr 30 12:45 nas_sys -> /nas/site/cron.d/nas_sys
lrwxrwxrwx 1 root root 25 Apr 30 12:45 nas_user -> /nas/site/cron.d/nas_user
-rw-r--r-- 1 root root 188 Apr 7 2006 sysstat
The nas_user file is as follows:
[root@RM1CS0AH0368 cron.d]# cat nas_user
0 0 * * 0 nasadmin /nas/bin/server_date server_2 timezone -name America/Chicago >&/dev/null
0 0 * * 0 nasadmin /nas/bin/server_date server_3 timezone -name America/Chicago >&/dev/null
0 0 * * 0 nasadmin /nas/bin/server_date server_4 timezone -name America/Chicago >&/dev/null
20 7,19 * * * nasadmin /home/nasadmin/email/savvol_email 90 >/home/nasadmin/email/sv_cron.log 2>&1
30 0,7,19,20 * * * nasadmin /home/nasadmin/email/repreport|/usr/sbin/sendmail -t >/home/nasadmin/email/repreport.log 2>&1
The script file is located in /home/nasadmin/email
repreport which has the following Contents:
printf "%s\n%s\n\n" "To:rustyfeo2@yahoo.com" "Subject:REP RM1 LONG FS Flight Status";
export NAS_DB=/nas;
/nas/bin/nas_replicate -i -a
Here is my question: if I edit the file under the folder /etc/cron.d/nas_user, do I have to restart the crond daemon?
/sbin/service crond restart
Also, what is the printf "%s\n%s\n\n" saying?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-17-2010 09:41 PM
тАО10-17-2010 09:41 PM
Re: Cron.d and Email
> [...] a linux box [...]
Not a very detailed description of anything.
> [...] if I edit the file under the folder
> /etc/cron.d/nas_user, do I have to restart
> the crond daemon?
man cron
man crontab
On many UNIX systems, an advantage of using
"crontab -e" is that the "cron" daemon gets
notified that the file has been changed, so
it must be re-read. If you edit one of these
files behind its back, then _you_ need to
tell the "cron" daemon to re-read its
configuration files. A complete re-start
should do it, but a less brutal method, like,
say "kill -HUP" may also do it.
On my Debian system, however, "man cron"
says:
[...]
Additionally, cron checks each minute to see if its spool directory's
modtime (or the modtime on /etc/crontab) has changed, and if it has,
cron will then examine the modtime on all crontabs and reload those
which have changed. Thus cron need not be restarted whenever a crontab
file is modified. Note that the crontab(1) command updates the modtime
of the spool directory whenever it changes a crontab.
method
[...]
which makes it sound as if it's all pretty
automatic.
Not a very detailed description of anything.
> [...] if I edit the file under the folder
> /etc/cron.d/nas_user, do I have to restart
> the crond daemon?
man cron
man crontab
On many UNIX systems, an advantage of using
"crontab -e" is that the "cron" daemon gets
notified that the file has been changed, so
it must be re-read. If you edit one of these
files behind its back, then _you_ need to
tell the "cron" daemon to re-read its
configuration files. A complete re-start
should do it, but a less brutal method, like,
say "kill -HUP" may also do it.
On my Debian system, however, "man cron"
says:
[...]
Additionally, cron checks each minute to see if its spool directory's
modtime (or the modtime on /etc/crontab) has changed, and if it has,
cron will then examine the modtime on all crontabs and reload those
which have changed. Thus cron need not be restarted whenever a crontab
file is modified. Note that the crontab(1) command updates the modtime
of the spool directory whenever it changes a crontab.
method
[...]
which makes it sound as if it's all pretty
automatic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2010 02:59 PM
тАО10-18-2010 02:59 PM
Re: Cron.d and Email
> Also, what is the printf "%s\n%s\n\n" saying?
The printf command lets you specify formatting and other options in a standard way (it follows the C printf command.)
What the above will do is print a string argument (%s), followed by a newline (\n), then a second string argument (%s) then two newlines (\n\n). Given the whole line, it should look like this (assuming the forum retains my spacing:
--
To:rustyfeo2@yahoo.com
Subject:REP RM1 LONG FS Flight Status
<"then it will insert the output of nas_replicate -i -a">
--
This follows the RFC822 specification for email messages, so that the command output will land in the body of the email.
The printf command lets you specify formatting and other options in a standard way (it follows the C printf command.)
What the above will do is print a string argument (%s), followed by a newline (\n), then a second string argument (%s) then two newlines (\n\n). Given the whole line, it should look like this (assuming the forum retains my spacing:
--
To:rustyfeo2@yahoo.com
Subject:REP RM1 LONG FS Flight Status
<"then it will insert the output of nas_replicate -i -a">
--
This follows the RFC822 specification for email messages, so that the command output will land in the body of the email.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2010 03:03 PM
тАО10-18-2010 03:03 PM
Re: Cron.d and Email
Thanks I will work with this information to see if I can get head way. I appreciate the info.
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
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP