Cron Job for Invoice Ninja

Discussion in 'General' started by onastvar, Sep 27, 2021.

  1. onastvar

    onastvar Member

    This is my "crontab -e"

    * * * * * cd /var/www/clients/client1/web1/web/billing2/artisan && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    * * * * * /usr/local/ispconfig/server/cron.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done

    Does first line (in bold) has correct syntax for crontab?

    According to Invoice Ninja documentation they have the following:

    cd /path/to/root/folder && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    The syntax looks fine. Is that really supposed to run as root? You can create a cronjob as the website user, and that's much preferred if the software functions that way.
     
    onastvar likes this.
  3. onastvar

    onastvar Member

    Thanks @Jesse Norell. Thanks for checking syntax, I appreciate it.
    I agree.
    I just wanted to make sure cron job works as expected,
    I'll create cron job under website user.
     
  4. onastvar

    onastvar Member

    This is my cron job under SITES > CRON JOBS
    * * * * * cd /var/www/clients/client1/web1/web/billing2/ && /usr/bin/php7.4 artisan schedule:run >> /dev/null 2>&1
    How can I add this cron to run as www-data
     
  5. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    In root's crontab you could use sudo. Alternately create the cronjob as www-data, or put it in /etc/crontab, which has a column for the user.
     
    onastvar likes this.
  6. onastvar

    onastvar Member

Share This Page