Grep the 'not running' jobs and will send the update in mail with its name(job)

my request is:
i have to create a script , which will grep the 'not running' jobs and will send the update in mail with its name(job)
Scenario:
logged in to machine abc
went to particular path: cd /a/b/c
then ./script1.sh status (script.sh is a script,whose status gives info about 10 jobs whether they are running or not running)

my idea is: ./scripts.sh status | grep not

so help me to create another script that grep the 'not running' from script.sh status and send the mail with the job name.
NOTE: this script should run in every 15 mins

Test that mailx works correctly and then

crontab -e 

00,15,30,45 0 0  0 0 [ -x /a/b/c/script.sh ] && /a/b/c/script.sh | grep not | mailx -s "Expired jobs" learner987@unix.com

1 Like