OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM Issue occured in Running Cron Command

This topic contains 2 replies, has 2 voices, and was last updated by  shreyas 7 years, 3 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #30491

    shreyas
    Participant

    Hi Team,

    I have written a Custom Command Class that contains tasks that has to be executed(DB related tasks) for certain amount of time that would be given in getDefaultDefinition(). Now when i set the cron, it behaves unexpected . At some times it Runs perfectly as expected But every alternative or so i get some wierd error as given below in screenshot:

    Error in Cron Command Execution

    And Sometimes it works perfectly fine as in given below screenshot:

    Cron Job for Command Successfully Run

    The alternative Passes & fail of Cron Command Summary is given in below Screenshot:
    Passes/Fail states of Command

    The Common error we get here for Fail state(As shown in screenshot above is) as: [InvalidArgumentException]
    Command “oro:cron:taskdelayevent-email” is not defined
    .

    I even thought is it due to some tasks written in execute() that is causing some exception & command fails but that is not the issue since when i run this manually in app/console it perfectly works as expected.

    i.e: Cron Command Success on Manual Run

    When i run this command any time manually as shown above , i do not get any exception.So i guess it is not from code written in this Execute() function. I am stuck on how to get over with this issue as it is necessary to be working as Automated & i cannot manually enter the command & run every now & then. i have followed similar way as other code i had written which is perfectly working fine without any issues except some logic changes in Execute() function & use of Repository here.

    Please find the code snippet of Code used in Custom Bundle (CustomTaskBundle/Command) :

    Pleas need help in how to solve this issue so that cron command would run correctly at regular interval of time specified in getDefaultDefinition() function.

    Thanks & Regards,
    Shreyas S

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #30492

    Mike Kudelya
    Participant

    Hi

    Maybe this topics can help you. First and second.
    I suggest you remove part of code and see errors disappear or not, if not – try again. You can start from getRepository, try to remove it from getDefaultDefinition(). Also look at app/logs, maybe you will find there some interesting information.

    #30493

    shreyas
    Participant

    Hi Mike,
    Thanks a lot for Suggestion. I tried removing part of code which had DB activities (i.e removed getRepository & also DB code present in getDefaultDefinition(). And kept only a single statement inside execute() function i.e: $output->writeln(“Execution Started”);. It gave the same error. There was some problem in my instance’s Database i think since when i used my instance code connect to different copy of Database with same tables & entities configuration by changing Database name in parameters.yml it worked perfectly fine without any issues.So i think my Database Tables had some issue now it is working fine after changing the Database.

    Thanks,
    Shreyas S

Viewing 2 replies - 1 through 2 (of 2 total)

The forum ‘OroCRM’ is closed to new topics and replies.

Back to top