Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7747891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:38:36+00:00 2026-06-01T10:38:36+00:00

Well, title self describes it.. I need to run a sql function to clean

  • 0

Well, title self describes it..
I need to run a sql function to clean some duplicated posts, i need to do it several times a day so i need to use cron…

I set a new crontab job, like this:

00 16,18,19,20,21 * * * mysql -h MY-DB-HOST.COM -u MY-DB-USERNAME -pMY-DB-PASSWORD -e "delete from hotaru_posts where post_id in ( select post_id from ( select post_id from hotaru_posts a group by post_title having count(post_title) > 1 ) b )" >> /tmp/cron_job.log

but nothing seems to be logged, so i supposed its not working.

Theres no problem with the sql sentence, thats not the issue here.

Anything wrong with my cron rule?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:38:38+00:00Added an answer on June 1, 2026 at 10:38 am

    well, since the mysql was not working properly directly inside crontab (thought that i think that was a path issue like Alex Howansky said), i created a php file dealing this query and called the php in crontab, much easier, and give me the option to use conditions.

    the cron job:

    00 8,14,18,19,20,21,23 * * * /usr/local/bin/php /home/aikaforum/cata/public_html/cron_dup.php >> /cata/tmp/cron_dup.log 
    

    the php:

    <?php
    $username="xxxxxxx";
    $password="xxxxxx";
    $dbname="xxxxxx";
    $dbhost="xxxxx.xxxxx.com";
    $query="delete from hotaru_posts where post_id in ( select post_id from ( select post_id from hotaru_posts a group by post_title having count(post_title) > 1 ) b )";
    mysql_connect($dbhost,$username,$password);
    @mysql_select_db($dbname) or die(strftime('%c')." Unable to select database");
    mysql_query($query);
    mysql_close();
    echo strftime('%c')." ok!";
    ?>
    

    Thanks for all the help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well the title is quite self explanatory. I want to build two panels one
Well I guess this has been asked a thousand times, but for some reason
Well, the title is quite self-explanatory... Is it possible to set default port number
Well, the title is pretty much self-explanatory. I've seen Quantian , but it's pretty
Well, the title is self-explanatory. I wondered this while compiling a project which has
Well title speaks for itself, I have a footer that I expect to at
Well the title pretty much sums the question. The only thing I found is
The title explains it pretty well, but I'm trying to build a 'for loop'
My title sums this up pretty well. My first though it to provide a
Well, the title's pretty much it: if I sat a non-techie/my mum/twelve-year old boy/cocker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.