Home Forums Support setting up cron

This topic contains 10 replies, has 4 voices, and was last updated by  Robink 1 month, 3 weeks ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #11242

    intradesign
    Participant

    Hi there,
    I have a question concerning cronjobs… The invoiceninja docs say

    “Create a cron to call the ninja:send-invoices and ninja:send-reminders commands once daily.”

    0 8 * * * /usr/local/bin/php /path/to/ninja/artisan ninja:send-invoices
    0 8 * * * /usr/local/bin/php /path/to/ninja/artisan ninja:send-reminders

    What exactly does “/path/to/ninja/artisan” mean?

    I cannot find a folder named artisan within the invoiceninja root or the /ninja subfolder.

    I am running invoiceninja on a centOS 7 server with plesk.

    What can I do?

    Thanks very much,
    Timo

    #11243

    zotya
    Participant

    artisan is a PHP file in the invoiceninja root

    #11245

    Titanfail
    Participant

    zotya’s got it. You’re essentially just running php artisan ninja:send-invoices (or send-reminders). The rest is just telling the system where to find the things you want to run.

    So by default, you’d be looking at something like

    0 8 * * * /usr/local/bin/php /var/www/ninja/artisan ninja:send-invoices
    0 8 * * * /usr/local/bin/php /var/www/ninja/artisan ninja:send-reminders

    and it would run those two tasks at 8am every day.

    #11246

    intradesign
    Participant

    Thanks very much… now it works!

    #21411

    Robink
    Participant

    Hello there,

    I’m having issues with the Cron task too, same configuration as here, CentOS + Plesk

    I must be missing something here, could you detail how to get this command to run ?

    I’m trying to run a command as follows from plesk interface, but I keep getting either file not found or command not found when trying to execute it.

    a
    b

    Could you tell me how you managed to do it ?
    indeed i connote fin any /usr/local/bin/php file or directory on the site root nor server root…

    thanks in advance for your kind help

    Robin.

    #21412

    Robink
    Participant

    pic1
    pic2

    #21413

    Titanfail
    Participant

    From the images you provided, it looks like the system is doing a guided setup of a cron, in which case using the actual syntax won’t work. It seems to be having an issue because it doesn’t recognize the schedule portion of the cron, as it’s expecting just a simple command. It will probably ask you when you want the command to run on a different screen.

    Also, be sure you’re using the actual PHP path for your particular setup. There’s always a chance it’s located somewhere other than /user/local/bin.

    #21416

    Robink
    Participant

    Hello Titanfail,

    Thanks for you reply.

    yes indeed it’s the Plesk UI to create cron tasks, that i tried after trying the command via SSH… unsuccessfully.

    I guess the problem is indeed the PHP path, i’ve check manually and I don’t have anything PHP on this user folder or site root folder.

    just found that documentation below, I guess this is the path I have to insert :
    https://docs.plesk.com/en-US/onyx/administrator-guide/76345/

    not sure about which php version i should specify tho…

    many thanks,
    Robin.

    ________

    On Linux :

    In Plesk for Linux, the PHP binary (the php file) is located in the following path:

    /opt/plesk/php/<PHP version>/bin/php

    Here <PHP version> should be replaced with a particular PHP version number.
    For example, if your domain uses PHP version 7.0, use the following command to run the my_script.php script:

    /opt/plesk/php/7.0/bin/php my_script.php

    _________

    #21417

    Robink
    Participant

    :: UPDATE ::

    Ok I apparently managed to specify the good paths for both Artisan and the command, but still an error, this one below :

    PHP Parse error: syntax error, unexpected ‘$value’ (T_VARIABLE) in /var/www/vhosts/musasabi.me/manage.musasabi.me/ninja/vendor/aws/aws-sdk-php/src/functions.php on line 36

    #21418

    Titanfail
    Participant

    PHP version should be 7.0, 7.1, or 7.2 (they don’t support 7.3 yet, IIRC). For future reference (seeing as you have console access), using which php will give you the path to your PHP binary. php -v will tell you what version your system is running.

    #21421

    Robink
    Participant

    Thanks for the hints Titanfail, it’s now solved !

    via the graphic interface of plesk, go to :

    Domains, click on your domain name, then click on Scheduled tasks on the right side, then Run PHP command, then select path of artisan, and type in the command to execute (ninja:send-invoices)

    Select the PHP version of the task (that’s where I had the last PHP parse error)
    Save and Execute the cron task.

    Repeat for the second task, ninja:send-reminders.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

Posted in: