Sponsored Content
Top Forums Shell Programming and Scripting Script that will send an email if the cron job did not run. Post 302994474 by jim mcnamara on Thursday 23rd of March 2017 10:55:21 AM
Old 03-23-2017
This question is really rather vague. But since I do not want to seesaw back and forth trying to extract details, consider:

1.cronjob opens for write a log e.g., /path/to/files/logfile
2. write a daemon in C that sleeps and wakes up every x minutes. It has a control file that tells it what files should be out there and how to check for success by finding the current file exists and reading it for error messages. It emails when it detects an error.

#1 and #2 are somewhat arbitrary because I have no idea what is needed.
How you do #1 and #2 is up to you.

Requirements:
A. There has to be a way for an independent monitor to send an alarm for a process that could never have run in the first place.

B. And for that same process to reliably write errors or the word 'failure' or something to a log file - when it does run and hits a problem. So the independent monitor can see a problem.

So it sounds like a rewrite of the cronjob script and development of a monitor.

PS: batch system software does this for you. Although cron does not necessarily do this, it can send email. But if the cronjob itself never actually is initiated then email will not work.
These 2 Users Gave Thanks to jim mcnamara For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

problem when the script is scheduled to run as cron job

Hello, I have problem in executing a shell script. When the shell script is executed at the shell prompt the script works successfully but when the same script is run as a cron job it fails to execute the files called within the shell script. I have scheduled the job in my crontab file as ... (6 Replies)
Discussion started by: forumthreads
6 Replies

2. UNIX for Dummies Questions & Answers

shell script run by user or cron job ?

My shell script runs fine both as a cron job and when i issue it. However, I wish to differentiate when it runs as a cron-job so the "echo" statements are not issued (they get mailed to me, which i don't want). I tried checking $USER but since the cron was created in my user that does not... (5 Replies)
Discussion started by: sentinel
5 Replies

3. Shell Programming and Scripting

script wont run from cron job

I have written a simple bash script that will run a wget command to recursively ftp an entire directories and it's contents. #!/bin/bash wget -r -N ftp://user:pass@server//VOL1/dir If I run from the regular command line it works fine. root@BUSRV: /media/backup1$ ./gwbu When I put it in... (1 Reply)
Discussion started by: mgmcelwee
1 Replies

4. UNIX for Advanced & Expert Users

Need help with a script run by a cron job.

Hi, new to this forum and not sure if this is the right place to post. I'm new to cron jobs and scripts, and I need some help with a script to be used with a cron job. I already have a bot set up at a certain website address and need a script that the cron job will load every day that tells it to... (1 Reply)
Discussion started by: klawless
1 Replies

5. Solaris

Shell Script gives error when run through cron job.

Hi, The following shell script runs without any problem when executed manulally. USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1) if then find /arch/AUBUAT/ -type f -mtime +0 | xargs rm find /arch/AUBMIG/ -type f -mtime +0 | xargs rm fi But the same gives below... (6 Replies)
Discussion started by: ksadiq79
6 Replies

6. Shell Programming and Scripting

how to avoid cron job output to send to the junk email folder?

Hi i created a cron job which invoke a shell script and output some content via email. Some times these output are sent to the junk email folder. i want these mails to be sent to inbox with some specific font. what i have to do? (4 Replies)
Discussion started by: vidhyaS
4 Replies

7. Shell Programming and Scripting

how to run a script using cron job and send the output as attachment via e-mail using unix

how to run a script using cron job and send the output as attachment via e-mail using unix. please help me. how my cron job entry should be? As of now my cron job entry is to run the script at specific time, 15 03 * * * /path/sample.sh | mail -s "Logs" email_id In the above entry, what... (8 Replies)
Discussion started by: vidhyaS
8 Replies

8. Shell Programming and Scripting

how do I run bash script using cron job

How do I run bash script using a cron job? I have tried to just write the path of the script, but that didn't work. (1 Reply)
Discussion started by: locoroco
1 Replies

9. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

10. Shell Programming and Scripting

I want to send an email after cron job

I am using centos 6.4. I have a few cron jobs setup and they all work fine. However, I would like to enhance one of the crons. This is what I have at the moment: nice rsync -au /home/samba/wsaler/* /home/samba/wsaler.backup/wsaler.backup18pm date | /bin/mail -s "wsaler 3:00pm backup... (8 Replies)
Discussion started by: countrydj
8 Replies
IPTRAF(8)						      System Manager's Manual							 IPTRAF(8)

NAME
iptraf - Interactive Colorful IP LAN Monitor SYNOPSIS
iptraf { [ -f ] [ -q ] [ -u ] [ { -i iface | -g | -d iface | -s iface | -z iface | -l iface } [ -t timeout ] [ -B [ -L logfile ] ] ] | [ -h ] } DESCRIPTION
iptraf is an ncurses-based IP LAN monitor that generates various network statistics including TCP info, UDP counts, ICMP and OSPF informa- tion, Ethernet load info, node stats, IP checksum errors, and others. If the iptraf command is issued without any command-line options, the program comes up in interactive mode, with the various facilities accessed through the main menu. OPTIONS
These options can also be supplied to the command: -i iface immediately start the IP traffic monitor on the specified interface, or all interfaces if "-i all" is specified -g immediately start the general interface statistics -d iface allows you to immediately start the detailed on the indicated interface (iface) -s iface allows you to immediately monitor TCP and UDP traffic on the specified interface (iface) -z iface shows packet counts by size on the specified interface -l iface start the LAN station monitor on the specified interface, or all LAN interfaces if "-l all" is specified -t timeout tells IPTraf to run the specified facility for only timeout minutes. This option is used only with one of the above parameters. -B redirect standard output to /dev/null, closes standard input, and forks the program into the background. Can be used only with one of the facility invocation parameters above. Send the backgrounded process a USR2 signal to terminate. -L logfile allows you to specify an alternate log file name. The default log file name is based on either the interface selected (detailed interface statistics, TCP/UDP service statistics, packet size breakdown), or the instance of the facility (IP traffic monitor, LAN station monitor). If a path is not specified, the log file is placed in /var/log/iptraf -f clears all locks and counters, causing this instance of IPTraf to think it's the first one running. This should only be used to recover from an abnormal termination or system crash. -u allow use of unsupported interfaces as ethernet devices. This is needed if you changed the name of an interface (ex: ip link set eth0 name foo0) -q no longer needed, maintained only for compatibility. -h shows a command summary SIGNALS
SIGUSR1 - rotates log files while program is running SIGUSR2 - terminates an IPTraf process running in the background. FILES
/var/log/iptraf/*.log - log file /var/lib/iptraf/* - important IPTraf data files SEE ALSO
Documentation/* - complete documentation written by the author AUTHOR
Gerard Paul Java (riker@mozcom.com) MANUAL AUTHOR
Frederic Peters (fpeters@debian.org), using iptraf -h General manual page modifications by Gerard Paul Java (riker@mozcom.com) IPTraf Help Page IPTRAF(8)
All times are GMT -4. The time now is 08:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy