jackaroo Posted March 28, 2006 Share Posted March 28, 2006 I entered the following on the command line: /home/myaccount/etc/automysqlbackup.sh and received the following email message as a result: /bin/sh: line 1: /home/myaccount/etc/automysqlbackup.sh: No such file or directory What am I doing wrong? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 28, 2006 Share Posted March 28, 2006 I'm not sure why you would get that error unless the script does not have execute permissions. However if you are wanting to backup a MySQL database I would recommend using dbsender and then follow the directions in this thread to configure it. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 18, 2007 Share Posted March 18, 2007 I'm not sure why you would get that error unless the script does not have execute permissions. However if you are wanting to backup a MySQL database I would recommend using dbsender and then follow the directions in this thread to configure it. I realize this thread is a year old but I wanted to ask if there have been any 'advancements' in the last year or is using dbsender still the recommended method to backup a MySQL database? Thanks. Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted March 18, 2007 Share Posted March 18, 2007 I would still recommend the dbsender script (I still use it on my sites) Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted March 18, 2007 Share Posted March 18, 2007 I am not sure what you mean with "advancements" but I have been using the dbsender for a while now. It emails me the database backup to a gmail account and I can not personally think of what else I would want it to do. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 18, 2007 Share Posted March 18, 2007 I am working on installing dbsender but there are some things I don't understand. The dbsender instructions say: If running from shell, put this above the <?php "#! /usr/bin/php -q" without the quotes!!! What is "shell"? Also, how do I chown the directory this script resides in to the same user or group your webserver runs in. Which directory do you recommend I put this? Quote Link to comment Share on other sites More sharing options...
MikeJ Posted March 18, 2007 Share Posted March 18, 2007 What is "shell"? Also, how do I chown the directory this script resides in to the same user or group your webserver runs in. Which directory do you recommend I put this? For your purpose, running from a shell is the same as running it from cron. As opposed to running it by putting it on your website and hitting a URL. So you will want the #!/usr/bin/php -q as the first line of your file (no blank lines before it), which tells the script where to find the PHP interpreter when the script is executed. If you are running it as cron, you shouldn't have to chown the directory or files, as it'll run as your account, not the webserver account. Location of the script should be anywhere in your account that isn't under public_html directory tree. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 18, 2007 Share Posted March 18, 2007 If you are running it as cron, you shouldn't have to chown the directory or files, as it'll run as your account, not the webserver account. Location of the script should be anywhere in your account that isn't under public_html directory tree. Thanks for helping. Is the location you mentioned above the place to put the script so that it is not accessible to others or is that where it needs to be to function/run properly? Just curious about that. Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted March 18, 2007 Share Posted March 18, 2007 It's just so that others can't run it. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 18, 2007 Share Posted March 18, 2007 If the script is asking: // Configure the path that this script resides on your server. $savepath = "/www/htdocs/dbsender"; // Full path to this directory. Do not use trailing slash! and I have put the file directly in the ftp.sitename.com directory. What would my path be? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 18, 2007 Share Posted March 18, 2007 Create a folder at the same level as the public_html folder. Then the path will be >/home/yourCpanelname/folder-you-create Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 18, 2007 Share Posted March 18, 2007 I believe I have made the proper entries in the .php file and uploaded it. Now, do I need to set up a cron job via cPanel or do I contact TCH support as the following quote seems to say? This script is meant to be setup on a crontab and run on a weekly basisYou will have to contact your system administrator to setup a cron tab for this script Here's an example crontab: 0 0-23 * * * php /path/to/thisdirectory/dbsender.php > dev/null Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted March 18, 2007 Share Posted March 18, 2007 You can create the cron job yourself. Just follow step 4 to 12 here. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 18, 2007 Share Posted March 18, 2007 You can create the cron job yourself. Just follow step 4 to 12 here. I realize you said to follow steps 4-12 but I couldn't help but read steps 1-3 and I was wondering if I was supposed to change permissions of the dbsender folder/file? Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted March 18, 2007 Share Posted March 18, 2007 You should follow the whole guide Bruce wrote, to get dbsender set up. Steps 4-12 was for the cron job question. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 18, 2007 Share Posted March 18, 2007 I agree with Thomas. Follow the guide. If it doesn't work or you get stuck then post a question. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 18, 2007 Share Posted March 18, 2007 I changed permissions of dbsender folder to 770, as specified in the TCH guide. Would I need to change permissions of the file itself? It is presently: 644 Also, the instructions that came with dbsender says: You must chown the directory this script resides in to the same user or group your webserver runsin, or CHMOD it to writable. I do not recommend chmod 777 but it's a quick solution. If you can setup a cron, you can probably chown your directory! Would it have been better for me to CHOWN the directory instead of CHMOD it to writable? Thanksl. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 18, 2007 Share Posted March 18, 2007 Since it is in your root folder no you don't need to do that. Just leave the folder set at 770 and you do not have to change the script permissions. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 20, 2007 Share Posted March 20, 2007 Should I have received some type of error message if I had the wrong path in my cron command and the script had ran? Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted March 20, 2007 Share Posted March 20, 2007 If anything is wrong with the cron job I think you will find a error message in the cpanelusernames mailbox (ie default adress). Please note that I don´t know all the reasons it may send a error message for (wrong path, wrong permissions etc), but its worth looking if there is a message. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted March 21, 2007 Share Posted March 21, 2007 How would I verify that the backup of my database worked properly? I was surprised to see that the .gz zipped file was 1K. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted March 21, 2007 Share Posted March 21, 2007 Open the file with WinZip and look at it. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted May 15, 2007 Share Posted May 15, 2007 I have been using dbsender and it looks like it has been emailing the database to me daily (as I had set up in cpanel). But I just noticed that I am getting a daily email from: "Cron Daemon" <root@server300.snhdns.com> Subject: Cron <myusername@server300> /usr/bin/php -q /home/myusername/dbsender/dbsender.php sh: ncftpput: command not found<h4><center>Database backup created and sent! File name/home/myusername/dbsender/myusername_local-051107-0200am_sql.tar.gz</center></h4><h4><center>/home/myusername/dbsender/myusername_local-051107-0200am_sql.tar.gzWas created and uploaded to your FTP server!</center></h4> Is this an error of some sort? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted May 15, 2007 Share Posted May 15, 2007 It looks like you have turned on the FTP fuction in dbsender which does not work. Check your dbsender script. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted June 8, 2007 Share Posted June 8, 2007 I just noticed that my 'default' email account is receiving an email each time that the cron backup is processed. From:Cron Daemon Subject: Cron <mysite@serverXXX> /usr/bin/php -q /home/myusername/dbsender/dbsender.php <h4><center>Database backup created and sent! File name/home/myusername/dbsender/myusername_directory-060807-0200am_sql.tar.gz</center></h4> I have the actual cron backup file sent to another email address. Is there a way to have the Cron Daemon email sent to another email address or to have it not sent at all? Thanks. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted June 8, 2007 Share Posted June 8, 2007 In the dbsender script find this section: // Send the message$ok = @mail($to, $subject, $message, $headers); if ($ok) { echo " Database backup created and sent! File name $filename2"; } else { echo " Mail could not be sent. Sorry!"; } And change it to this: // Send the message$ok = @mail($to, $subject, $message, $headers); if (!$ok) { echo " Mail could not be sent. Sorry!";} Or add an email address to send it too. Just changing it to send a message on failure would be sufficient. If you don't receive the backup you can check your default account email. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted June 8, 2007 Share Posted June 8, 2007 1) The changes that you show in your quote will stop any email from being sent, right? 2) Where do I add the email address to send the email to? 3) How would I change it to only have a message sent if there was a failure? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted June 8, 2007 Share Posted June 8, 2007 1. it will stop mail being sent on a successful backup 2. $ok = @mail($to, $subject, $message, $headers); 3. Change it to look like my second quote and it will only send on failure. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted June 12, 2007 Share Posted June 12, 2007 2. $ok = @mail($to, $subject, $message, $headers); <-- change $to to a valid email address I'm not smart enough to figure out how change $to a valid email address. My latest attempt was: 2. $ok = @mail(myemail@host.com, $subject, $message, $headers); But I've been getting this message from Cron Daemon in my default email: <br /><b>Parse error</b>: syntax error, unexpected '@' in <b>/home/username/dbsender/dbsender.php</b> on line <b>115</b><br /> Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted June 12, 2007 Share Posted June 12, 2007 In the dbsender script find this section: // Send the message$ok = @mail($to, $subject, $message, $headers); if ($ok) { echo " Database backup created and sent! File name $filename2"; } else { echo " Mail could not be sent. Sorry!"; } And change it to this: // Send the message$ok = @mail($to, $subject, $message, $headers); if (!$ok) { echo " Mail could not be sent. Sorry!";} Just do the above and you will stop recieving the emails. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted June 12, 2007 Share Posted June 12, 2007 I like the option that you earlier mentioned: Or add an email address to send it too. Just changing it to send a message on failure would be sufficient. If you don't receive the backup you can check your default account email. I'm trying to figure out how to add the email address. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted June 12, 2007 Share Posted June 12, 2007 Try escaping the email address: you\@yourdomain.ext or just above the $ok line add a line >$to = you@yourdomain.ext; and change the email address you tried to add back to $to Quote Link to comment Share on other sites More sharing options...
rnmcd Posted June 13, 2007 Share Posted June 13, 2007 I'll first try 'escaping the email address: you\@yourdomain.ext'. I'll see how that goes. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted June 13, 2007 Share Posted June 13, 2007 I tried escaping the email address but ended up getting an email from Cron Daemon. Here is the message: <br /><b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/home/username/dbsender/dbsender.php</b> on line <b>115</b><br /> <br /> <b>Parse error</b>: syntax error, unexpected '@' in <b>/home/username/dbsender/dbsender.php</b> on line <b>115</b><br /> I entered my email address, in dbsender.php, in the format: you\@yourdomain.ext Did I do something wrong? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted June 13, 2007 Share Posted June 13, 2007 The problem you have is you are seeing output that the script is producing. Since the script is being run by cron there is no output device as if you were executing the script from your web browser. I have modified my dbsender scripts as explained in this post. If you want to stop those mail sent messages from going to your default account you will have to change your script. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted June 13, 2007 Share Posted June 13, 2007 Is that all you have tried? I've given you three different things to do. One of them should work for you. Above I've mentioned that I've tried 2 or 3 methods. But I get a Cron Daemon email error each time. I have not yet tried: or just above the $ok line add a line >$to = you@yourdomain.ext; I will try that next. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted June 13, 2007 Share Posted June 13, 2007 It's not going to work, see my post above yours. The problem you have is you are seeing output that the script is producing. Since the script is being run by cron there is no output device as if you were executing the script from your web browser. I have modified my dbsender scripts as explained in this post. If you want to stop those mail sent messages from going to your default account you will have to change your script. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted June 13, 2007 Share Posted June 13, 2007 So none of these will work: post I am trying to get the Cron Daemon sent to me only upon a database-sending failure. I understand that link will stop any cron daemon email from being sent. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted February 8, 2008 Share Posted February 8, 2008 Is dbsender still working for you guys? It was working for me for awhile but now I no longer get the db attachment in the email that the cron sends. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 8, 2008 Share Posted February 8, 2008 All six of my cron backups are working fine using dbsender. You may want to compare your script with the Backup thread. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted February 8, 2008 Share Posted February 8, 2008 Bruce, how big of .gz files are you receiving? I am wondering if gmail is blocking my attachments. They are around 30MB. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 8, 2008 Share Posted February 8, 2008 I don't send them to GMail, I send them to a domain hosted address but you may be on to something with the size limit. Check GMail's limits. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted February 8, 2008 Share Posted February 8, 2008 I found: With Gmail, you can send and receive messages up to 20 megabytes (MB) in size. Where can I read more about TCH's backup policy? I don't have access to a domain hosted email account on a server other than the one I am trying to back up so I can't have the file sent there that at this time. Also, I believe that TCH support told me that 34MB was the largest file I could send from my domain and I might get to that limit soon anyway. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 8, 2008 Share Posted February 8, 2008 I send the backups to a domain hosted email address and then retrieve it with my email client. My databases are no where near as large as yours. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted February 8, 2008 Share Posted February 8, 2008 I send the backups to a domain hosted email address and then retrieve it with my email client. My databases are no where near as large as yours. Where can I read more about TCH's backup policy? Maybe I can just rely on those backups. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 8, 2008 Share Posted February 8, 2008 TCH backups run nightly but TCH is not responsible for your data. It's a benefit you receive because the backups are run but it's your data and as such your responsibility. I searched the forums (I know a novel idea). Backup Policy Quote Link to comment Share on other sites More sharing options...
rnmcd Posted February 9, 2008 Share Posted February 9, 2008 I send the backups to a domain hosted email address and then retrieve it with my email client. My databases are no where near as large as yours. Are there size limits for emails sent to and from a TCH hosted email account? Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted February 9, 2008 Share Posted February 9, 2008 From - Not that I know about. To - Only the limit you have set on the mail account I belive. Also, I saw earlier in the thread that you were asking how big attachments gmail allows, I believe it´s 20 mb. Quote Link to comment Share on other sites More sharing options...
rnmcd Posted February 13, 2008 Share Posted February 13, 2008 From - Not that I know about.To - Only the limit you have set on the mail account I belive. Also, I saw earlier in the thread that you were asking how big attachments gmail allows, I believe it´s 20 mb. How do I check the size of my mysql database? My website is over 20MB but I don't think my mysql db is that large. Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted February 13, 2008 Share Posted February 13, 2008 Easiest way would be to go in to your cpanel, then backups and download a backup of the database to your local computer and check what it says in explorer. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 13, 2008 Share Posted February 13, 2008 How do I check the size of my mysql database? My website is over 20MB but I don't think my mysql db is that large. Checking the size of the database would be a waste of time since dbsender does not send you the database. It sends you a compressed dump of the database which is typically much smaller than the database itself. Making a backup and downloading it to your machine will give you an approximate size of the file dbsender will send. But remember, the file will be encoded for sending and will end up being larger than the compressed file you download. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.