A Plesk cron manager question.

Community support for Plesk, CPanel, WebMin and others with insight from two of the founders of Plesk. Ask for help here! No question is too simple or complicated. :-)
carliebentley
Forum User
Forum User
Posts: 46
Joined: Mon Oct 09, 2006 5:32 pm

A Plesk cron manager question.

Unread post by carliebentley »

I'm looking to perform a check and optimize of all databases, all tables every night at midnight.

I think I have the "time" thing figured out, but I still have the following questions.

1. When adding a new cron through plesk, which user should I select? root? mysql?
2. What would be the exact mysqlcheck statement that I need to run in order check and optimize all of the DBs and tables running in the MySQL server.
3. Is there a way to monitor if there is an error during the optimization? Will it send me an e-mail?

This is a CentOS 5 box with Plesk 8.3.0 and several ART upgrades like MySQL 5, qgreylist, etc.

Thanks a bundle.
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: A Plesk cron manager question.

Unread post by breun »

It doesn't matter if you manage cron jobs through Plesk or from the command line. You're editing the same crontabs.
  1. If you're going to hardcode the MySQL admin password in your cronjob (not recommended) it doesn't matter which user's crontab you use. If your cronjob is going to read /etc/psa/.psa.shadow for the password (recommended), then you'll need to use a user that is allowed to read that file (psaadm or root).
  2. See mysqlcheck --help and/or man mysqlcheck. To optimize all databases you can use mysqlcheck --user=admin --password=`cat /etc/psa/.psa.shadow` --optimize --all-databases
  3. I believe any output is e-mailed to the crontab's owner by default (root is aliased to the admin address you set in Plesk). You could try to redirect standard output to /dev/null and only have standard error output normally, so only errors will be mailed to you. You'll probably want to test this.
Lemonbit Internet Dedicated Server Management
Post Reply