Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesServer Administration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old August 20th, 2005, 10:22 PM
portal's Avatar
portal portal is offline
PHP Newb
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: East Coast
Posts: 154 portal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 32 sec
Reputation Power: 2
Send a message via AIM to portal Send a message via MSN to portal
Cron job: need to replace mutt command, need assistance

I hope this is the right place to be posting this. I'm trying to run a cron job, but mutt isn't installed. My webhost says sendmail is what to use.

The line in the script is:

if [ $MAXATTSIZE -ge $ATTSIZE ]
then
BACKUPFILES=`echo "$BACKUPFILES" | sed -e "s# # -a #g"` #enable multiple attachments
mutt -s "MySQL Backup Log and SQL Files for $HOST - $DATE" $BACKUPFILES $MAILADDR < $LOGFILE
else
cat "$LOGFILE" | mail -s "WARNING! - MySQL Backup exceeds set maximum attachment size on $HOST - $DATE" $MAILADDR


I've tried rewriting the mutt part but I only get errors.

Reply With Quote
  #2  
Old August 22nd, 2005, 08:44 AM
Milo Milo is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Italy
Posts: 192 Milo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Cron job: need to replace mutt command, need assistance

What exactly are you writing in the sendmail function???

Reply With Quote
  #3  
Old August 23rd, 2005, 01:05 PM
portal's Avatar
portal portal is offline
PHP Newb
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: East Coast
Posts: 154 portal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 32 sec
Reputation Power: 2
Send a message via AIM to portal Send a message via MSN to portal
RE: Cron job: need to replace mutt command, need assistance

Not really php but figured I'd put it in tags just to be safe. Here's the whole code.

php Code:
Original - php Code
  1. #!/bin/bash
  2. #
  3. # MySQL Backup Script
  4. # VER. 2.2 - http://sourceforge.net/projects/automysqlbackup/
  5. # Copyright (c) 2002-2003 wipe_out@lycos.co.uk
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20. #
  21. #=================================================  ====================
  22. #=================================================  ====================
  23. # Set the following variables to your system needs
  24. # (Detailed instructions below variables)
  25. #=================================================  ====================
  26.  
  27. # Username to access the MySQL server e.g. dbuser
  28. USERNAME=exampleusername
  29.  
  30. # Username to access the MySQL server e.g. password
  31. PASSWORD=examplepw
  32.  
  33. # Host name (or IP address) of MySQL server e.g localhost
  34. DBHOST=localhost
  35.  
  36. # List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
  37. DBNAMES="all"
  38.  
  39. # Backup directory location e.g /backups
  40. BACKUPDIR="/home/mysite/public_html/backupdb"
  41.  
  42. # Mail setup
  43. # What would you like to be mailed to you?
  44. # - log   : send only log file
  45. # - files : send log file and sql files as attachments (see docs)
  46. # - stdout : will simply output the log to the screen if run manually.
  47. MAILCONTENT="files"
  48.  
  49. # Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs])
  50. MAXATTSIZE="8000"
  51.  
  52. # Email Address to send mail to? (user@domain.com)
  53. MAILADDR="email@mysite.com"
  54.  
  55.  
  56. # ==================================================  ==========
  57. # === ADVANCED OPTIONS ( Read the doc's below for details )===
  58. #=================================================  ============
  59.  
  60. # List of DBBNAMES for Monthly Backups.
  61. MDBNAMES="mysql $DBNAMES"
  62.  
  63. # List of DBNAMES to EXCLUDE if DBNAMES are set to all (must be in " quotes)
  64. DBEXCLUDE=""
  65.  
  66. # Include CREATE DATABASE in backup?
  67. CREATE_DATABASE=no
  68.  
  69. # Separate backup directory and file for each DB? (yes or no)
  70. SEPDIR=yes
  71.  
  72. # Which day do you want weekly backups? (1 to 7 where 1 is Monday)
  73. DOWEEKLY=4
  74.  
  75. # Choose Compression type. (gzip or bzip2)
  76. COMP=gzip
  77.  
  78. # Command to run before backups (uncomment to use)
  79. #PREBACKUP="/etc/mysql-backup-pre"
  80.  
  81. # Command run after backups (uncomment to use)
  82. #POSTBACKUP="/etc/mysql-backup-post"
  83.  
  84. #=================================================  ====================
  85. # Options documantation
  86. #=================================================  ====================
  87. # Set USERNAME and PASSWORD of a user that has at least SELECT permission
  88. # to ALL databases.
  89. #
  90. # Set the DBHOST option to the server you wish to backup, leave the
  91. # default to backup "this server".(to backup multiple servers make
  92. # copies of this file and set the options for that server)
  93. #
  94. # Put in the list of DBNAMES(Databases)to be backed up. If you would like
  95. # to backup ALL DBs on the server set DBNAMES="all".(if set to "all" then
  96. # any new DBs will automatically be backed up without needing to modify
  97. # this backup script when a new DB is created).
  98. #
  99. # If the DB you want to backup has a space in the name replace the space
  100. # with a % e.g. "data base" will become "data%base"
  101. # NOTE: Spaces in DB names may not work correctly when SEPDIR=no.
  102. #
  103. # You can change the backup storage location from /backups to anything
  104. # you like by using the BACKUPDIR setting..
  105. #
  106. # The MAILCONTENT and MAILADDR options and pretty self explanitory, use
  107. # these to have the backup log mailed to you at any email address or multiple
  108. # email addresses in a space seperated list.
  109. # (If you set mail content to "log" you will require access to the "mail" program
  110. # on your server. If you set this to "files" you will have to have mutt installed
  111. # on your server. If you set it sto stdout it will log to the screen if run from
  112. # the console or to the cron job owner if run through cron)
  113. #
  114. # MAXATTSIZE sets the largest allowed email attachments total (all backup files) you
  115. # want the script to send. This is the size before it is encoded to be sent as an email
  116. # so if your mail server will allow a maximum mail size of 5MB I would suggest setting
  117. # MAXATTSIZE to be 25% smaller than that so a setting of 4000 would probably be fine.
  118. #
  119. # Finally copy automysqlbackup.sh to anywhere on your server and make sure
  120. # to set executable permission. You can also copy the script to
  121. # /etc/cron.daily to have it execute automatically every night or simply
  122. # place a symlink in /etc/cron.daily to the file if you wish to keep it
  123. # somwhere else.
  124. # NOTE:On Debian copy the file with no extention for it to be run
  125. # by cron e.g just name the file "automysqlbackup"
  126. #
  127. # Thats it..
  128. #
  129. #
  130. # === Advanced options doc's ===
  131. #
  132. # The list of MDBNAMES is the DB's to be backed up only monthly. You should
  133. # always include "mysql" in this list to backup your user/password
  134. # information along with any other DBs that you only feel need to
  135. # be backed up monthly. (if using a hosted server then you should
  136. # probably remove "mysql" as your provider will be backing this up)
  137. # NOTE: If DBNAMES="all" then MDBNAMES has no effect as all DBs will be backed
  138. # up anyway.
  139. #
  140. # If you set DBNAMES="all" you can configure the option DBEXCLUDE. Other
  141. # wise this option will not be used.
  142. # This option can be used if you want to backup all dbs, but you want
  143. # exclude some of them. (eg. a db is to big).
  144. #
  145. # Set CREATE_DATABASE to "yes" (the default) if you want your SQL-Dump to create
  146. # a database with the same name as the original database when restoring.
  147. # Saying "no" here will allow your to specify the database name you want to
  148. # restore your dump into, making a copy of the database by using the dump
  149. # created with automysqlbackup.
  150. # NOTE: Not used if SEPDIR=no
  151. #
  152. # The SEPDIR option allows you to choose to have all DBs backed up to
  153. # a single file (fast restore of entire server in case of crash) or to
  154. # seperate directories for each DB (each DB can be restored seperately
  155. # in case of single DB corruption or loss).
  156. #
  157. # To set the day of the week that you would like the weekly backup to happen
  158. # set the DOWEEKLY setting, this can be a value from 1 to 7 where 1 is Monday,
  159. # The default is 6 which means that weekly backups are done on a Saturday.
  160. #
  161. # COMP is used to choose the copmression used, options are gzip or bzip2.
  162. # bzip2 will produce slightly smaller files but is more processor intensive so
  163. # may take longer to complete.
  164. #
  165. # Use PREBACKUP and POSTBACKUP to specify Per and Post backup commands
  166. # or scripts to perform tasks either before or after the backup process.
  167. #
  168. #
  169. #=================================================  ====================
  170. # Backup Rotation..
  171. #=================================================  ====================
  172. #
  173. # Daily Backups are rotated weekly..
  174. # Weekly Backups are run by default on Saturday Morning when
  175. # cron.daily scripts are run...Can be changed with DOWEEKLY setting..
  176. # Weekly Backups are rotated on a 5 week cycle..
  177. # Monthly Backups are run on the 1st of the month..
  178. # Monthly Backups are NOT rotated automatically...
  179. # It may be a good idea to copy Monthly backups offline or to another
  180. # server..
  181. #
  182. #=================================================  ====================
  183. # Please Note!!
  184. #=================================================  ====================
  185. #
  186. # I take no resposibility for any data loss or corruption when using
  187. # this script..
  188. # This script will not help in the event of a hard drive crash. If a
  189. # copy of the backup has not be stored offline or on another PC..
  190. # You should copy your backups offline regularly for best protection.
  191. #
  192. # Happy backing up...
  193. #