grantiago
Posts: 3
Joined: Thu Feb 11, 2021 7:19 pm

Cron and Highcharts export server

Hi: I have the export server running from my home directory. All works as expected. Thank you. It is pretty slick! From the command line in my home directory It works perfectly. I wrote a bash script to automate the process. that works as well. As long as I run it in my home directory.

Code: Select all

#!/usr/bin/env bash
cd "$(dirname "$0")"
PHP=`which php`
# echo $PHP php -v
$PHP /home/me/highcharts_combined_array.php # generates the highcharts formated json file
sleep 2
highcharts-export-server -logLevel 4 -infile high_combined.json -outfile /www/x/public_html/php/x/images/combined_chart.png
the bash script is executable. It runs the php file.

The problem is if I run it as a cron job I get the following error:

Code: Select all

/home/me/highcharts_x_combined.sh: 10: /home/me/highcharts_x_combined.sh: highcharts-export-server: not found
here is my cron job:

Code: Select all

cd /home/me/ &&  /home/me/highcharts_x_combined.sh
I've tried another half dozen variations on the cronjob.

Code: Select all

Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic
node -v  
v8.10.0
export server  v2.1.0
log message from the command line. Working in my home directory:

Code: Select all

Thu Aug 04 2022 17:30:40 GMT-0600 (MDT) [verbose] attaching exit listeners to the process..
Thu Aug 04 2022 17:30:40 GMT-0600 (MDT) [verbose] Pool started:
    maxWorkers: 1
    initialWorkers: 1
    workLimit: 60
    listening to process exit: true
Thu Aug 04 2022 17:30:40 GMT-0600 (MDT) [verbose] phantom 1 - spawning worker
Thu Aug 04 2022 17:30:40 GMT-0600 (MDT) [verbose] starting export
Thu Aug 04 2022 17:30:40 GMT-0600 (MDT) [verbose] attempting to export from input file
Thu Aug 04 2022 17:30:40 GMT-0600 (MDT) [verbose] phantom - received work, finding available worker
Thu Aug 04 2022 17:30:40 GMT-0600 (MDT) [verbose] phantom - found available worker
Thu Aug 04 2022 17:30:40 GMT-0600 (MDT) [verbose] phantom 1 - starting work
Thu Aug 04 2022 17:30:41 GMT-0600 (MDT) [notice] phantom worker 1 finished work ??? in 556 ms
Thu Aug 04 2022 17:30:41 GMT-0600 (MDT) [notice] phantom worker 1 - process was closed
Thu Aug 04 2022 17:30:41 GMT-0600 (MDT) [notice] terminating, killing all running phantom processes
hopefully someone can answer my question.
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Cron and Highcharts export server

Hi there,

Welcome to our forum and thank you for contacting us with your question!

First of all, could you please tell me how did you install the export server? At the first glance it seems that it is not installed globally on your computer, so make sure that it is a global installation.

If that won't help, could you please show us your bash script? We will run it and test if we got any errors in our dev environment.

Waiting for your reply,
Best regards!
Kamil Musiałowski
Highcharts Developer
grantiago
Posts: 3
Joined: Thu Feb 11, 2021 7:19 pm

Re: Cron and Highcharts export server

Thanks for the reply. I rewrote the whole chart in a python library and am using the resulting graph as a .png. It is not as good looking and doesn't have as many features as highcharts, but it will have to do. I will come back to this when the export server makes the full transition to Puppeteer. Thanks again. I'm a fan of highcharts, but I have already spent too much time on this. ¯\_(ツ)_/¯
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Cron and Highcharts export server

Sure, I understand that. It's great to hear that you like Highcharts!

In case of any other questions, feel free to contact us,
Best regards!
Kamil Musiałowski
Highcharts Developer
grantiago
Posts: 3
Joined: Thu Feb 11, 2021 7:19 pm

Re: Cron and Highcharts export server

I do have time for this:

Code: Select all

me@myhost:~$ npm -g ls
/usr/local/lib
└─┬ [email protected]
  ├─┬ [email protected]
  │ └── [email protected]
... etc.
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Cron and Highcharts export server

Turns out that export server is installed globally, so in that case I would suggest asking at a more general forum like Stack Overflow as it seems like it's not a Highcharts problem, but maybe a cron problem or some issue with your bash script.

Regards!
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Usage”