setting up cron

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

artisan is a PHP file in the invoiceninja root

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.

Thanks very much… now it works!

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.

pic1
pic2

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.

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


:: 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

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.

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.

Hello @titanfail, i know this is a 2 year old topic but when i was going through the conversation in search of answers i got here where you mentioned what PHP artisan is, which was very helpful to clarify the confusion I’m currently having about cron Jobs,
i have installed Invoice Ninja v5 via softaculous in cPanel, Due to cost issues I’m replacing WHMCS with this Invoice ninja V5 self Hosted install and I’m trying to set it up so i can manually recreate my 30 customer accounts and also make use of recurring invoices.
so my question to you or anyone who can help is about this cron command:

/usr/local/bin/php /var/www/ninja/artisan ninja:send-invoices
DO I JUST PASTE IT LIKE THAT ?
or to my incomplete understanding: do i replace USER with my cpanel user & PHP with my cyrrent php version 7.4, and WWW. do i replace it with public.html then lastly NINJA do i replace it with the cPanel subdomain directory name where i installed my versio like this:
/My-cPanel-user/local/bin/ea-php74/public_html/My-cPanel-Ninja-DIrectory/artisan ninja:send-invoices

My question is WHAT DO I REPLACE ? WITH WHAT?

Thank you guys in advance