12-17-2008
I made the script
############################################################
#! /bin/sh
export PATH=$PATH:/opt/mysql/bin/
#echo $PATH
echo $LD_LIBRARY_PATH
USER="root"
PASS="qwa"
DB="shell"
DATE=$(date +%d%b%y_%k.%M.%S)
#DATE=`date +%y-%d-%m`
mysqldump -u $USER -p$PASS $DB | gzip -9>/home/backup/today_sme-$DATE.sql.gz
find /home/smebackup -mtime +60 -exec rm -f {} \;
# script to send simple email
# email subject
SUBJECT="live sme database backup"
# Email To ?
EMAIL="xyz
@wqs.com"
# Email text/message
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "Backup of shell database is done successfully"> $EMAILMESSAGE
# echo "This is email text" >>$EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
echo "done"
############################################################
It does
1=takes backup
2=delete file before 60 days
3=send a mail
But when I channged mysqldump-->sqldymp (just for test purpose) still it send mail "backup done successfully" while mysqldump command doesnot execute
I want If command execute successfully then only mail should be sent How can I do this
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys,
Is it possible to make SOAP calls from within Unix shell scripts?
I need to access a web service from within UNIX in order to lookup something while I am doing some parsing on a file.
Regards,
Laud (2 Replies)
Discussion started by: Laud12345
2 Replies
2. Shell Programming and Scripting
Here is what I have:
#!/bin/bash
# Setup year date and month
YR=`date +%Y '{print $6}'`
MON=`date +%b '{print $2}'`
DAY=`date +%d '{print $3}'`
file=$YR$MOY$DOM
# clear
# Dump database using USER/PASS to ..sql
mysqldump --user=me -ppass database > database-db.$file.sql
The YR, MON and... (2 Replies)
Discussion started by: npereira
2 Replies
3. Shell Programming and Scripting
hello experts
cany any one help me i want to make one script which can rlogin to another machine .
but it should not ask me username/password from me of another machine it should take the username and password from the script only.
please help me out.
regards,
shary (2 Replies)
Discussion started by: shary
2 Replies
4. Shell Programming and Scripting
Dear all
Dear Brother
I am bit new to programming or shell scripting. I have given one shell script which is regarding combining all the 240 or less files in a particular folderwhich is related to one hour of the day. There will be 24 these kind of folders related to a day . It means there... (4 Replies)
Discussion started by: girish.batra
4 Replies
5. Shell Programming and Scripting
Hi,
i have written a shell script and its working fine till now. Now, i have to enhance it with a small updation.
i need to make a file inside my file that will contain the below parameters
1) Customer_id
2) Server_id
3) No. Account
All the above variables are already been taken in... (3 Replies)
Discussion started by: dazdseg
3 Replies
6. Shell Programming and Scripting
Hi all
I need help for the issue below.
I need to create script:
FORM_cmd=query || import
FORM_command=add
FORM_msisdn=389881234567
FORM_provcode=SK
FORM_attr=12
FORM_cmd can be "query" or "import"
when FORM_cmd="query" then execute -> spdci -cmd $FORM_cmd FORM_cmd
when... (3 Replies)
Discussion started by: vasil
3 Replies
7. Shell Programming and Scripting
I run a small instrument lab. We track our user's time on the instruments with a very manual process of 'last wtmp.1' then cut/paste data into spreadsheets. My boss makes the initial spreadsheets then I convert and format them for uploading into our billing software (COReS). Cores is looking for a... (8 Replies)
Discussion started by: jpontius
8 Replies
8. Shell Programming and Scripting
I have a situation where I have a list of airplanes that make a series of flights.
Therefore I am looking up the different flights that each airplane makes based on a postgres sql query:
select flightid from plane where airplane='DELTAx'
As a result I get a series of flight numbers... (0 Replies)
Discussion started by: JSNY
0 Replies
9. Shell Programming and Scripting
Hello, im a new user on this site and learning scripting very slowly at a understanding pace. However i am up with a challenge and require help completing this.
The script has to include arguments, variables, decisions and loops. So the script is about calculating the broadcast address for any... (5 Replies)
Discussion started by: tHe666
5 Replies
10. UNIX for Beginners Questions & Answers
This script is executed whenever a new vehicle is added to the cycle-motor park
of campus. The script asks for the following information about the car and adds a new
line to the vehicle file.txt: name (name of an animal, unique identifier), color, mark,
model, type (e.g., electrical, manual),... (2 Replies)
Discussion started by: andre2222
2 Replies
LEARN ABOUT DEBIAN
jifty::notification
Jifty::Notification(3pm) User Contributed Perl Documentation Jifty::Notification(3pm)
NAME
Jifty::Notification - Send emails from Jifty
USAGE
It is recommended that you subclass Jifty::Notification and override "body", "html_body", "subject", "recipients", and "from" for each
message. (You may want a base class to provide "from", "preface" and "footer" for example.) This lets you keep all of your notifications
in the same place.
However, if you really want to make a notification type in code without subclassing, you can create a "Jifty::Notification" and call the
"set_body", "set_subject", and so on methods on it.
METHODS
new [KEY1 => VAL1, ...]
Creates a new Jifty::Notification. Any keyword args given are used to call set accessors of the same name.
Then it calls "setup".
setup
Your subclass should override this to set the various field values.
send_one_message
Delivers the notification, using the Email::Send mailer defined in the "Mailer" and "MailerArgs" configuration arguments. Returns true if
mail was actually sent. Note errors are not the only cause of mail not being sent -- for example, the recipients list could be empty.
If you wish to send HTML mail, set "html_body". If this is not set (for backwards compatibility) a plain-text email is sent. If
"html_body" and "body" are both set, a multipart mail is sent. See Email::MIME::CreateHTML for how this is done.
Be aware that if you haven't set "recipients", this will fail silently and return without doing anything useful.
set_headers MESSAGE
Takes a Email::MIME object "MESSAGE", and modifies it as necessary before sending it out. As the method name implies, this is usually used
to add or modify headers. By default, does nothing; this method is meant to be overridden.
body [BODY]
Gets or sets the body of the notification, as a string.
subject [SUBJECT]
Gets or sets the subject of the notification, as a string.
from [FROM]
Gets or sets the from address of the notification, as a string.
recipients [RECIPIENT, ...]
Gets or sets the addresses of the recipients of the notification, as a list of strings (not a reference).
email_from OBJECT
Returns the email address from the given object. This defaults to calling an 'email' method on the object. This method will be called by
"send" to get email addresses (for "to") out of the list of "recipients".
to_list [OBJECT, OBJECT...]
Gets or sets the list of objects that the message will be sent to. Each one is sent a separate copy of the email. If passed no
parameters, returns the objects that have been set. This also suppresses duplicates.
send
Sends an individual email to every user in "to_list"; it does this by setting "to" and "recipient" to the first user in "to_list" calling
Jifty::Notification's "send" method, and progressing down the list.
Additionally, if "to" was set elsewhere, sends an email to that person, as well.
to
Of the list of users that "to" provided, returns the one which mail is currently being sent to. This is set by the "send" method, such
that it is available to all of the methods that Jifty::Notification's "send" method calls.
preface
Print a header for the message. You want to override this to print a message.
Returns the message as a scalar.
footer
Print a footer for the message. You want to override this to print a message.
Returns the message as a scalar.
full_body
The main, plain-text part of the message. This is the preface, body, and footer joined by newlines.
full_html
Same as full_body, but with HTML.
parts
The parts of the message. You want to override this if you want to send multi-part mail. By default, this method returns a single part
consisting of the result of calling "$self->full_body".
Returns the parts as an array reference.
magic_letme_token_for PATH
Returns a Jifty::LetMe token which allows the current user to access a path on the site.
perl v5.14.2 2011-01-26 Jifty::Notification(3pm)