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;








0















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









share|improve this question






















  • 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

















0















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









share|improve this question






















  • 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













0












0








0








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









share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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










1 Answer
1






active

oldest

votes


















0














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/






share|improve this answer























  • 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











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
);



);













draft saved

draft discarded


















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









0














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/






share|improve this answer























  • 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















0














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/






share|improve this answer























  • 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













0












0








0







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/






share|improve this answer













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/







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company