|
Linux Training Community :: CentOS |
|
|
|
|
|
Subject :back up script not working..
2009-10-21 03:30:03
|
|
|
jimjam |
|
|
 |
Joined: 2009-09-26 23:15:15
Posts: 24
Location: |
|
|
Hi, I have found a script to back up my databases and placed it in etc.cron/cron.daily trouble is nothing happens, I'm a newbie so have no idea why this script is not executing. The script is attached. When i placed it in the cron I did not give it an extension, it looked just like this "automysqlbackup" Should scripts have a .sh after its name? I tried to post the code of this script here, but it says i don't have permission. I tried to upload the script as a text file and the file type of txt is not allowed. The script I used was this one http://sourceforge.net/projects/automysqlbackup/
Thanks |
IP Logged
|
Last Edited On: 2009-10-21 03:30:03 By jimjam for the Reason |
|
|
|
|
|
|
Subject :Re:back up script not working..
2009-10-21 06:47:40
|
|
|
MikeW |
|
Rookery Moderator |
 |
Joined: 2009-06-03 13:47:46
Posts: 66
Location: |
|
|
Here are the options you need to change for the script:
USERNAME=dbuser
PASSWORD=password
DBNAMES="DB1 DB2 DB3"
BACKUPDIR="/backups"
Check these settings to see if they are correct. The user must have the rights to your database. Be sure the database names are listed and the location is correct for where they will be backed up.
Check the script and make sure it is executable:
chmod 755 automysqlbackup.sh2.5
Run this from the command line first with:
sh automysqlbackup.sh.2.5
If it does not work your settings are incorrect. After it works then post your crontab so you can make it automatic and I will help you with that. |
IP Logged
|
|
|
|
|
|
|
Subject :Re:back up script not working..
2009-10-21 07:16:51
|
|
|
jimjam |
|
|
 |
Joined: 2009-09-26 23:15:15
Posts: 24
Location: |
|
|
rootATlocalhost cron.daily]# sh automysqlbackup.sh
: command not found line 26:
: command not found line 29:
: command not found line 32:
: command not found line 35:
: command not found line 38:
: command not found line 41:
: command not found line 49:
: command not found line 52:
: command not found line 55:
: command not found line 56:
: command not found line 60:
: command not found line 63:
: command not found line 66:
: command not found line 69:
: command not found line 72:
: command not found line 75:
: command not found line 78:
: command not found line 81:
: command not found line 84:
: command not found line 87:
: command not found line 90:
: command not found line 93:
: command not found line 96:
: command not found line 338:
: command not found line 350:
automysqlbackup.sh: line 407: syntax error near unexpected token
automysqlbackup.sh: line 407: `dbdump |
IP Logged
|
|
|
|
|
|
|
Subject :Re:back up script not working..
2009-10-21 07:34:32
|
|
|
MikeW |
|
Rookery Moderator |
 |
Joined: 2009-06-03 13:47:46
Posts: 66
Location: |
|
|
Are you running the command as root?
The root user has access to commands that a regular user does not and they are in the PATH of the root user.
Do this:
su -
Type in your root password and run the script again and let me know. |
IP Logged
|
|
|
|
|
|
|
Subject :Re:back up script not working..
2009-10-21 07:57:06
|
|
|
jimjam |
|
|
 |
Joined: 2009-09-26 23:15:15
Posts: 24
Location: |
|
|
Yes, I am logged in as root via a putty session |
IP Logged
|
|
|
|
|
|
|
Subject :Re:back up script not working..
2009-10-21 13:18:30
|
|
|
jimjam |
|
|
 |
Joined: 2009-09-26 23:15:15
Posts: 24
Location: |
|
|
I made another user, granted that user all privileges% made the changes in the script, ran it and it worked 
The script is now residing in cron.daily and hopefully when I wake up tomorrow and check it will have worked. 
Where can I choose the time that cron.daily will run? |
IP Logged
|
Last Edited On: 2009-10-21 13:18:30 By jimjam for the Reason |
|
|
|
|