thedesignstudent Posted February 16, 2008 Share Posted February 16, 2008 Here's how I understand it. I configure the script. Change email 'no' to 'yes'. and...? Do I copy and paste this script into the command line space in the standard cron manager? I want to automate my backups for all of my bulletin boards, starting with my first. I'll be back after the install, and I'll be able to see what it's like to manage more than one in the manager once I get the okay. Also, if I wanted to set the job up at 3 am every night, should I go to the advanced manager and enter 0 3 * * * ? Seems simple enough. Thanks! p.s. I'm also a little confused on being able to edit the job once I've got it entered into the command line and have sent it away. Will there be a delete cron job 1 button in the cron job manager? I'll see, but if it's something else that's simple, feel free to mention it. Thank you again. Here's the script I'll be entering ----------------------------------------------------- // configure your database variables below: $dbhost = 'localhost'; // Server address of your MySQL Server $dbuser = 'cpanelname_DBuser'; // Username to access MySQL database $dbpass = 'user-password'; // Password to access MySQL database $dbname = 'cpanelname_DBname'; // Database Name // Optional Options You May Optionally Configure $use_gzip = "yes"; // Set to No if you don't want the files sent in .gz format $remove_sql_file = "yes"; // Set this to yes if you want to remove the .sql file after gzipping. Yes is recommended. $remove_gzip_file = "yes"; // Set this to yes if you want to delete the gzip file also. I recommend leaving it to "no" // Configure the path that this script resides on your server. $savepath = "/home/cpanelname/path-to-script"; // Full path to this directory. Do not use trailing slash! $send_email = "yes"; // Do you want this database backup sent to your email? Fill out the next 2 lines $to = "validuser@your-destination.com"; // Who to send the emails to $from = "validuser@your-domain.com"; // Who should the emails be sent from? $senddate = date("j F Y"); $subject = "MySQL Database Backup - $senddate"; // Subject in the email to be sent. $message = "MySQL database has been backed up and is attached to this email"; // Brief Message. Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted February 16, 2008 Share Posted February 16, 2008 You would upload the whole php file in to the folder you created in step 1-3 in the Backup Faq thread 1. Create a folder in your /home/cpanelname folder called dbsender 2. Change permissions of dbsender folder to 770 3. Upload edited dbsender.php script to dbsender folder you created As for which cron manager to use, I would use the standard. Quote Link to comment Share on other sites More sharing options...
thedesignstudent Posted February 17, 2008 Author Share Posted February 17, 2008 You would upload the whole php file in to the folder you created in step 1-3 in the Backup Faq thread 1. Create a folder in your /home/cpanelname folder called dbsender 2. Change permissions of dbsender folder to 770 3. Upload edited dbsender.php script to dbsender folder you created As for which cron manager to use, I would use the standard. Thanks. In the tutorial the link to dbsender.php is no longer valid. Here's a copy of the script. Quote Link to comment Share on other sites More sharing options...
thedesignstudent Posted February 19, 2008 Author Share Posted February 19, 2008 Thanks. In the tutorial the link to dbsender.php is no longer valid. Here's a copy of the script. Here's where I am. <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/home/username/dbsender/friends/friendsbackup.php</b> on line <b>3</b><br /> <br /> <b>Parse error</b>: syntax error, unexpected T_STRING in <b>/home/username/dbsender/friends/friendsbackup.php</b> on line <b>3</b><br /> my actual username has been substituted with 'username' The Cron Daemon is doing its job. I used the script highlighted above in the link I provided, the one in the TCH tutorial is 404. Here's the mail headline that gets mailed to me: Cron <username@serverxxx> /usr/bin/php -q /home/username/dbsender/friends/friendsbackup.php username and server number have been substituted. Permissions on dbsender and friends directories are 770. any hints are appreciated. I try to make it work everyday and I've been learning something new everyday this week. This is one I'm getting working. Thanks so much for all of the wonderful help and support, I'm doing things I never dreamed I'd be able to do, but always wanted to do. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 19, 2008 Share Posted February 19, 2008 Double check that all command lines are ending with a semi-colon in the script. Double check your paths, and be sure you are entering the correct variable information. Like your database name should be prefaced with your cpanelname_ as well as your database user name. Quote Link to comment Share on other sites More sharing options...
thedesignstudent Posted February 20, 2008 Author Share Posted February 20, 2008 Double check that all command lines are ending with a semi-colon in the script. Double check your paths, and be sure you are entering the correct variable information. Like your database name should be prefaced with your cpanelname_ as well as your database user name. Here's the message that came from Tina (TCH). It turns out that everything is configured fine, and I did a line-by-line reading of the file for syntax. What's happening is that the source file I copied had incorrect syntax in it. Tina was able to spot it easily, for me it's understanding a new language that's coming to me through use. I'm new to php and I was able to check for ; close commands and =$variables and my own inputs thanks to Thomas earlier this month, but when it came to new syntax I've never seen before I wasn't quite sure what I was looking at and therein was what has been preventing the cron job from running smoothly. If anyone wouldn't mind pasting a proven working copy of the php file here, that would be awesome. Either way, I'm correcting the syntax the best I can spot the errors, and if I reach my destination before a copy is up here, I'll either paste it into the forum or host it on my server. Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 20, 2008 Share Posted February 20, 2008 I have attached a copy of the script to the Backup FAQ thread (it's at the bottom of the first post). Quote Link to comment Share on other sites More sharing options...
thedesignstudent Posted February 27, 2008 Author Share Posted February 27, 2008 I have attached a copy of the script to the Backup FAQ thread (it's at the bottom of the first post). For the love of all things PHP and Bruce. I had somewhat given up. Sitting here listing to a song from the 80's a friend is playing on her radio station since she's always asking what I'd like played. Tinkering with a message from Facebook a friend in Japan by way of BC left me. Well... I changed one little command in your file Bruce, and as I looked in my gmail not expecting to see anything other than another error message. There's my backup in full. You guys really are the best!!! I posted my first classified for designing web pages earlier in Feb and Total Choice is the host I'm recommending to everyone. I have some decent basic html skills and some illustrator and photoshop skills, with a little php, mysql and java we'll see what I'm doing in the future weeks and months. There's no telling with the support I've received. Thanks for everything! I'll have to see how I made it work in the morning and give it another go and test uploading the backup. Can't thank you all enough... Bruce, Thomas and Tina and everyone who has helped me learn so much this past month. I'm listening to the Bee Gee's and I'm not stopping here. Thanks again. It truly can't be said enough here. John Lennon plays us out... 'Imagine all the people, living for today...' Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 27, 2008 Share Posted February 27, 2008 Glad it's working. And thanks for the kind words. Quote Link to comment Share on other sites More sharing options...
TCH-Thomas Posted February 27, 2008 Share Posted February 27, 2008 You´re welcome. Quote Link to comment Share on other sites More sharing options...
thedesignstudent Posted February 28, 2008 Author Share Posted February 28, 2008 I have a question . I noticed my disk space went from 383.37mb to 452.98mb after running some of the commands. I'm wondering what I can do to limit the disk space used besides reducing the nightly backup to a weekly backup? I didn't choose to save a copy in the php program, but it seems as if maybe there's a copy being saved. I was thinking that I could go into the file manager and delete whatever was happening to regain my space. Do you happen to know of any common errors that could be causing this? I have the job forwarded directly to a gmail account and it bypasses 'my email' and all forwarding here at TCH. Thanks. Otherwise, everything is great! Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted February 29, 2008 Share Posted February 29, 2008 Make sure you set this line to "yes" to delete the backup after it sends. $remove_sql_file = "yes"; // Set this to yes if you want to remove the .sql file after gzipping. Yes is recommended. And your backups will be stored where ever you have this path set to. $savepath = "/home/yourcpanelname/dbsender"; // Full path to this directory. Do not use trailing slash! Hope that helps. Quote Link to comment Share on other sites More sharing options...
thedesignstudent Posted February 29, 2008 Author Share Posted February 29, 2008 Make sure you set this line to "yes" to delete the backup after it sends. And your backups will be stored where ever you have this path set to. Hope that helps. Thank you again. Somehow I downloaded the zip onto the server instead of mailing it to myself. The rest of the space I used before thinking to mail it (the zip) directly to my gmail account. All part of the learning, but it's been going great. 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.