mysqldump cron job runs in terminal but not cron tabWhy is my crontab not working, and how can I troubleshoot it?Connecting to a new MySQL instanceUsing mysqldump in cron job without root password/etc/crontab or any user crontab is not being executedMysqldump stopping website service during backup processMySQL server CPU usage shot up for no apparent reason. Any idea why?Creating a *Consistent* *Online* MySQL Backup with InnoDB AND MyISAM tablesCron Job not running ( too many open files )mysqldump not working/running via cron jobCrontab not working to send email/etc/crontab file not executed
How to use memset in c++?
Rebus with 20 song titles
How do I prevent employees from either switching to competitors or opening their own business?
How to tell your grandparent to not come to fetch you with their car?
concatenation of context sensitive and context-free is context sensitive or not?
With Ubuntu 18.04, how can I have a hot corner that locks the computer?
Non-disclosure agreement in a small business
Union with anonymous struct with flexible array member
Is a lack of character descriptions a problem?
Arriving at the same result with the opposite hypotheses
Is it expected that a reader will skip parts of what you write?
Check if three arrays contains the same element
How to communicate to my GM that not being allowed to use stealth isn't fun for me?
Importance of Building Credit Score?
What ways have you found to get edits from non-LaTeX users?
Is it legal for a bar bouncer to confiscate a fake ID
Implement Own Vector Class in C++
How can I get an unreasonable manager to approve time off?
How do governments keep track of their issued currency?
How to trick the reader into thinking they're following a redshirt instead of the protagonist?
Mathematically, why does mass matrix / load vector lumping work?
Were Alexander the Great and Hephaestion lovers?
How can this tool find out registered domains from an IP?
Colloquialism for “see you later”
mysqldump cron job runs in terminal but not cron tab
Why is my crontab not working, and how can I troubleshoot it?Connecting to a new MySQL instanceUsing mysqldump in cron job without root password/etc/crontab or any user crontab is not being executedMysqldump stopping website service during backup processMySQL server CPU usage shot up for no apparent reason. Any idea why?Creating a *Consistent* *Online* MySQL Backup with InnoDB AND MyISAM tablesCron Job not running ( too many open files )mysqldump not working/running via cron jobCrontab not working to send email/etc/crontab file not executed
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have this cron job,
/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql &>/backup/CronBackup/cronBackupLog.log
I have been through this page:
Why is my crontab not working, and how can I troubleshoot it?
The cronBackupLog.log never appears after the cron running...
running grep mysqldump cron
in the /var/log
directory shows:
[root@server log]# grep mysqldump cron
May 20 00:00:01 server CROND[3104]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 21 00:00:01 server CROND[15318]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 00:00:01 server CROND[23517]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 10:30:01 server CROND[17670]: (username) CMD (/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 11:00:01 server CROND[18543]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql &>/backup/CronBackup/cronBackupLog.log)
so I know it must be starting at least.. The problem is, if I run the command I am trying to in the terminal, it executes, and a couple minutes later it is complete and i have a new database backup. If I go into phpmyadmin, cron jobs, and insert this to run every 12 hours or 30 minutes, or whatever it might be (typically 12 hours as you can see above), it just doesn't complete any critical tasks.
I am interested in creating a time based file name but, probably after I get the basic one working.
Any more advice on how I can go about trouble shooting this would be helpful, I feel like I am completely missing something. Thank you.
Would running as root user versus, a user with all mysql permissions have any difference? As I said, running it in terminal works, and it does so using a high permission user. I am just not sure if running as root is required for the cron.
Running
CentOS 6.10
MySQL Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
centos mysql backup cron troubleshooting
add a comment |
I have this cron job,
/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql &>/backup/CronBackup/cronBackupLog.log
I have been through this page:
Why is my crontab not working, and how can I troubleshoot it?
The cronBackupLog.log never appears after the cron running...
running grep mysqldump cron
in the /var/log
directory shows:
[root@server log]# grep mysqldump cron
May 20 00:00:01 server CROND[3104]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 21 00:00:01 server CROND[15318]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 00:00:01 server CROND[23517]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 10:30:01 server CROND[17670]: (username) CMD (/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 11:00:01 server CROND[18543]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql &>/backup/CronBackup/cronBackupLog.log)
so I know it must be starting at least.. The problem is, if I run the command I am trying to in the terminal, it executes, and a couple minutes later it is complete and i have a new database backup. If I go into phpmyadmin, cron jobs, and insert this to run every 12 hours or 30 minutes, or whatever it might be (typically 12 hours as you can see above), it just doesn't complete any critical tasks.
I am interested in creating a time based file name but, probably after I get the basic one working.
Any more advice on how I can go about trouble shooting this would be helpful, I feel like I am completely missing something. Thank you.
Would running as root user versus, a user with all mysql permissions have any difference? As I said, running it in terminal works, and it does so using a high permission user. I am just not sure if running as root is required for the cron.
Running
CentOS 6.10
MySQL Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
centos mysql backup cron troubleshooting
What does& >
mean?
– Rick James
May 22 at 23:17
@RickJames to be honest I am not 100% sure.. I copied it from another website that specified how to output to a file with this process.
– Dorian Waite
May 23 at 0:46
Normally&
means do the statement in the background. I don't know about the rest.
– Rick James
May 23 at 5:22
add a comment |
I have this cron job,
/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql &>/backup/CronBackup/cronBackupLog.log
I have been through this page:
Why is my crontab not working, and how can I troubleshoot it?
The cronBackupLog.log never appears after the cron running...
running grep mysqldump cron
in the /var/log
directory shows:
[root@server log]# grep mysqldump cron
May 20 00:00:01 server CROND[3104]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 21 00:00:01 server CROND[15318]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 00:00:01 server CROND[23517]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 10:30:01 server CROND[17670]: (username) CMD (/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 11:00:01 server CROND[18543]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql &>/backup/CronBackup/cronBackupLog.log)
so I know it must be starting at least.. The problem is, if I run the command I am trying to in the terminal, it executes, and a couple minutes later it is complete and i have a new database backup. If I go into phpmyadmin, cron jobs, and insert this to run every 12 hours or 30 minutes, or whatever it might be (typically 12 hours as you can see above), it just doesn't complete any critical tasks.
I am interested in creating a time based file name but, probably after I get the basic one working.
Any more advice on how I can go about trouble shooting this would be helpful, I feel like I am completely missing something. Thank you.
Would running as root user versus, a user with all mysql permissions have any difference? As I said, running it in terminal works, and it does so using a high permission user. I am just not sure if running as root is required for the cron.
Running
CentOS 6.10
MySQL Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
centos mysql backup cron troubleshooting
I have this cron job,
/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql &>/backup/CronBackup/cronBackupLog.log
I have been through this page:
Why is my crontab not working, and how can I troubleshoot it?
The cronBackupLog.log never appears after the cron running...
running grep mysqldump cron
in the /var/log
directory shows:
[root@server log]# grep mysqldump cron
May 20 00:00:01 server CROND[3104]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 21 00:00:01 server CROND[15318]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 00:00:01 server CROND[23517]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 10:30:01 server CROND[17670]: (username) CMD (/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql)
May 22 11:00:01 server CROND[18543]: (username) CMD (/usr/bin/mysqldump -u username -p'password' MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql &>/backup/CronBackup/cronBackupLog.log)
so I know it must be starting at least.. The problem is, if I run the command I am trying to in the terminal, it executes, and a couple minutes later it is complete and i have a new database backup. If I go into phpmyadmin, cron jobs, and insert this to run every 12 hours or 30 minutes, or whatever it might be (typically 12 hours as you can see above), it just doesn't complete any critical tasks.
I am interested in creating a time based file name but, probably after I get the basic one working.
Any more advice on how I can go about trouble shooting this would be helpful, I feel like I am completely missing something. Thank you.
Would running as root user versus, a user with all mysql permissions have any difference? As I said, running it in terminal works, and it does so using a high permission user. I am just not sure if running as root is required for the cron.
Running
CentOS 6.10
MySQL Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
centos mysql backup cron troubleshooting
centos mysql backup cron troubleshooting
asked May 22 at 18:40
Dorian WaiteDorian Waite
1
1
What does& >
mean?
– Rick James
May 22 at 23:17
@RickJames to be honest I am not 100% sure.. I copied it from another website that specified how to output to a file with this process.
– Dorian Waite
May 23 at 0:46
Normally&
means do the statement in the background. I don't know about the rest.
– Rick James
May 23 at 5:22
add a comment |
What does& >
mean?
– Rick James
May 22 at 23:17
@RickJames to be honest I am not 100% sure.. I copied it from another website that specified how to output to a file with this process.
– Dorian Waite
May 23 at 0:46
Normally&
means do the statement in the background. I don't know about the rest.
– Rick James
May 23 at 5:22
What does
& >
mean?– Rick James
May 22 at 23:17
What does
& >
mean?– Rick James
May 22 at 23:17
@RickJames to be honest I am not 100% sure.. I copied it from another website that specified how to output to a file with this process.
– Dorian Waite
May 23 at 0:46
@RickJames to be honest I am not 100% sure.. I copied it from another website that specified how to output to a file with this process.
– Dorian Waite
May 23 at 0:46
Normally
&
means do the statement in the background. I don't know about the rest.– Rick James
May 23 at 5:22
Normally
&
means do the statement in the background. I don't know about the rest.– Rick James
May 23 at 5:22
add a comment |
1 Answer
1
active
oldest
votes
I personally always create a backup script in bash, and then use this in the crontab rather than using the mysqldump command itself, this provides more control and easier debugging, although using the mysqldump command should also work. I am wondering if adding --single-transaction
to the cron would help.
/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql
Also ensure the cron user has permission to write to the /backup/CronBackup
directory.
Also here is a good link https://www.linode.com/docs/databases/mysql/use-mysqldump-to-back-up-mysql-or-mariadb/
Yeah that might be something I need to try, considering that what I am doing isn't working out to be the best. I did add--single-transaction
before, and it shows in the results of my grep command, though it didn't create any legitimate results. I will check permissions for the directory and I skimmed through your article real quickly. Will try creating a backup script, and if that doesn't work, use the instructions in the article you sent... The two are a similar process it seems.
– Dorian Waite
May 23 at 0:48
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f968470%2fmysqldump-cron-job-runs-in-terminal-but-not-cron-tab%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I personally always create a backup script in bash, and then use this in the crontab rather than using the mysqldump command itself, this provides more control and easier debugging, although using the mysqldump command should also work. I am wondering if adding --single-transaction
to the cron would help.
/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql
Also ensure the cron user has permission to write to the /backup/CronBackup
directory.
Also here is a good link https://www.linode.com/docs/databases/mysql/use-mysqldump-to-back-up-mysql-or-mariadb/
Yeah that might be something I need to try, considering that what I am doing isn't working out to be the best. I did add--single-transaction
before, and it shows in the results of my grep command, though it didn't create any legitimate results. I will check permissions for the directory and I skimmed through your article real quickly. Will try creating a backup script, and if that doesn't work, use the instructions in the article you sent... The two are a similar process it seems.
– Dorian Waite
May 23 at 0:48
add a comment |
I personally always create a backup script in bash, and then use this in the crontab rather than using the mysqldump command itself, this provides more control and easier debugging, although using the mysqldump command should also work. I am wondering if adding --single-transaction
to the cron would help.
/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql
Also ensure the cron user has permission to write to the /backup/CronBackup
directory.
Also here is a good link https://www.linode.com/docs/databases/mysql/use-mysqldump-to-back-up-mysql-or-mariadb/
Yeah that might be something I need to try, considering that what I am doing isn't working out to be the best. I did add--single-transaction
before, and it shows in the results of my grep command, though it didn't create any legitimate results. I will check permissions for the directory and I skimmed through your article real quickly. Will try creating a backup script, and if that doesn't work, use the instructions in the article you sent... The two are a similar process it seems.
– Dorian Waite
May 23 at 0:48
add a comment |
I personally always create a backup script in bash, and then use this in the crontab rather than using the mysqldump command itself, this provides more control and easier debugging, although using the mysqldump command should also work. I am wondering if adding --single-transaction
to the cron would help.
/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql
Also ensure the cron user has permission to write to the /backup/CronBackup
directory.
Also here is a good link https://www.linode.com/docs/databases/mysql/use-mysqldump-to-back-up-mysql-or-mariadb/
I personally always create a backup script in bash, and then use this in the crontab rather than using the mysqldump command itself, this provides more control and easier debugging, although using the mysqldump command should also work. I am wondering if adding --single-transaction
to the cron would help.
/usr/bin/mysqldump -u username -p'password' --single-transaction MyDatabase > /backup/CronBackup/MyDatabaseBackup.sql
Also ensure the cron user has permission to write to the /backup/CronBackup
directory.
Also here is a good link https://www.linode.com/docs/databases/mysql/use-mysqldump-to-back-up-mysql-or-mariadb/
answered May 22 at 23:18
gerryamurphygerryamurphy
215
215
Yeah that might be something I need to try, considering that what I am doing isn't working out to be the best. I did add--single-transaction
before, and it shows in the results of my grep command, though it didn't create any legitimate results. I will check permissions for the directory and I skimmed through your article real quickly. Will try creating a backup script, and if that doesn't work, use the instructions in the article you sent... The two are a similar process it seems.
– Dorian Waite
May 23 at 0:48
add a comment |
Yeah that might be something I need to try, considering that what I am doing isn't working out to be the best. I did add--single-transaction
before, and it shows in the results of my grep command, though it didn't create any legitimate results. I will check permissions for the directory and I skimmed through your article real quickly. Will try creating a backup script, and if that doesn't work, use the instructions in the article you sent... The two are a similar process it seems.
– Dorian Waite
May 23 at 0:48
Yeah that might be something I need to try, considering that what I am doing isn't working out to be the best. I did add
--single-transaction
before, and it shows in the results of my grep command, though it didn't create any legitimate results. I will check permissions for the directory and I skimmed through your article real quickly. Will try creating a backup script, and if that doesn't work, use the instructions in the article you sent... The two are a similar process it seems.– Dorian Waite
May 23 at 0:48
Yeah that might be something I need to try, considering that what I am doing isn't working out to be the best. I did add
--single-transaction
before, and it shows in the results of my grep command, though it didn't create any legitimate results. I will check permissions for the directory and I skimmed through your article real quickly. Will try creating a backup script, and if that doesn't work, use the instructions in the article you sent... The two are a similar process it seems.– Dorian Waite
May 23 at 0:48
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f968470%2fmysqldump-cron-job-runs-in-terminal-but-not-cron-tab%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What does
& >
mean?– Rick James
May 22 at 23:17
@RickJames to be honest I am not 100% sure.. I copied it from another website that specified how to output to a file with this process.
– Dorian Waite
May 23 at 0:46
Normally
&
means do the statement in the background. I don't know about the rest.– Rick James
May 23 at 5:22