LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-16-2014, 08:01 AM   #16
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 242

Original Poster
Rep: Reputation: 1

Quote:
Originally Posted by chrism01 View Post
You've got an extra character at the start of the first one
Code:
]#!/bin/bash
I also recommend using the 'set' debug cmd as the 2nd line thus
Code:
#!/bin/bash
set -xv
That "]" was not there.

Code:
-bash-3.2$ sudo ./server1-weekly_2nd
if ps -ef | grep server1-backup ; then
mailx -r  abs@company.com-s "SERVER1 Weekly Backup still running!"
else
mailx -r abc@company.com -s "SERVER1 Weekly Backup COMPLETED!"
fi
+ ps -ef
+ grep server1-backup
    root 27447     1   1 13:34:52 ?           3:32 bpbkar -r 2678400 -ru root -dt 0 -to 0 -clnt server1-backup -class server1_
    root 14894 14892   0 13:59:02 pts/25      0:00 grep server1-backup
+ mailx -r abs@company.com-s 'SERVER1 Weekly Backup still running!'
The flags you gave are used only when sending mail.
Usage: mailx -eiIUdFntBNHvV~ -T FILE -u USER -h hops -r address
                -s SUBJECT -f FILE users

-bash-3.2$
I got above error when I entered "set -xv"


BUT WHEN I RUN THIS SCRIPT I GET BACKUP COMPLETD MAIL QUICKLY EVEN THOUGH BACKUP IS STILL RUNNING.I MEAN TO SAY EVEN THOUGH BPBKAR SHOWING IN ps -ef output.
Please advise.

Last edited by manalisharmabe; 04-16-2014 at 08:04 AM.
 
Old 04-16-2014, 08:05 AM   #17
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
1. re the ']'; I merely quoted your post.

2. You've missed a space here 'abs@company.com-s'
 
1 members found this post helpful.
Old 04-16-2014, 09:18 AM   #18
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 849

Rep: Reputation: 201Reputation: 201Reputation: 201
What does "ps" return? Not sure offhand. So I would use ps | wc -l to check the number of lines returned. Also top is generally better than ps.

This should take care of the first part.

For mailx, as others said, you got options in the wrong order.

OK
 
Old 04-18-2014, 01:35 AM   #19
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 242

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by chrism01 View Post
1. re the ']'; I merely quoted your post.

2. You've missed a space here 'abs@company.com-s'
Let me check if that was the cause.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to send mail when the mail queue is more than 100 Arun Kurian Linux - Server 2 11-06-2013 11:53 AM
Send input from one script to another menu based script. simonedgcumbe Programming 9 03-24-2010 10:22 PM
How can I write a script to send general mail to my users at 9AM everyday in Linux 4 mostafaashish Linux - General 3 03-03-2010 07:19 AM
Using 'mail' in a script to send mail on an alternate port? tim914 Linux - Software 4 01-16-2009 04:23 PM
CGI Script runs to send mail, but mail is never sent robertwo Linux - Newbie 2 06-10-2004 10:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration