<div dir="ltr">Are you root when you successfully run it in the terminal? Could it be an issue with the root user environment when running it in the cron?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 4 Jun 2019 at 05:52, davorinbajic <<a href="mailto:davorinbajic@gmail.com">davorinbajic@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I use the gdal_grid interpolation command. When I work in the terminal<br>
everything works perfectly. However, when I try to run the command in the<br>
bash script from cron then it does not work.<br>
<br>
Bash script (/root/interpolation/interpolation.sh):<br>
<br>
#!/bin/bash<br>
<br>
gdal_grid -ot Float64 -of GTiff -outsize 750 750 -a<br>
invdist:power=2.0:smoothing=0.0:radius1=0.08:radius2=0.08:angle=0.0:max_points=0:min_points=0<br>
/root/interpolation/today.vrt /root/interpolation/out/today.tif<br>
<br>
I also tried the path to gdal_grid<br>
<br>
#!/bin/bash<br>
<br>
/usr/bin/gdal_grid -ot Float64 -of GTiff -outsize 750 750 -a<br>
invdist:power=2.0:smoothing=0.0:radius1=0.08:radius2=0.08:angle=0.0:max_points=0:min_points=0<br>
/root/interpolation/today.vrt /root/interpolation/out/today.tif<br>
<br>
Virtual file (/root/interpolation/today.vrt)<br>
<br>
<OGRVRTDataSource><br>
<OGRVRTLayer name="today"><br>
    <SrcDataSource>/root/interpolation/today.csv</SrcDataSource><br>
    <GeometryType>wkbPoint</GeometryType><br>
<LayerSRS>WGS84</LayerSRS><br>
    <GeometryField encoding="PointFromColumns" x="X" y="Y" z="eto"/><br>
</OGRVRTLayer><br>
<br>
CSV (/root/interpolation/today.csv)<br>
<br>
id,X,Y,eto<br>
1,17.11400986,43.59461212,5.284<br>
2,16.01515388,44.38002777,5.636<br>
3,19.3653698,44.19543839,6.823<br>
4,17.25690269,44.1989975,6.041<br>
5,18.53639221,43.60323715,6.452<br>
6,16.9213295,45.12902069,6.95<br>
...<br>
<br>
CRON<br>
<br>
PATH='/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin'<br>
<br>
39 10 * * * /root/interpolation/interpolation.sh <br>
<br>
Error<br>
<br>
Usage: gdal_grid [--help-general] [--formats]<br>
[-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/<br>
      CInt16/CInt32/CFloat32/CFloat64}]<br>
[-of format] [-co "NAME=VALUE"]<br>
[-zfield field_name]<br>
[-a_srs srs_def] [-spat xmin ymin xmax ymax]<br>
[-clipsrc <xmin ymin xmax ymax>|WKT|datasource|spat_extent]<br>
[-clipsrcsql sql_statement] [-clipsrclayer layer]<br>
[-clipsrcwhere expression]<br>
[-l layername]* [-where expression] [-sql select_statement]<br>
[-txe xmin xmax] [-tye ymin ymax] [-outsize xsize ysize]<br>
[-a algorithm[:parameter1=value1]*]    [-q]<br>
<src_datasource> <dst_filename><br>
<br>
Available algorithms and parameters with their's defaults:<br>
Inverse distance to a power (default)<br>
<br>
invdist:power=2.0:smoothing=0.0:radius1=0.0:radius2=0.0:angle=0.0:max_points=0:min_points=0:nodata=0.0<br>
Moving average<br>
    average:radius1=0.0:radius2=0.0:angle=0.0:min_points=0:nodata=0.0<br>
Nearest neighbor<br>
    nearest:radius1=0.0:radius2=0.0:angle=0.0:nodata=0.0<br>
Various data metrics<br>
    <metric name>:radius1=0.0:radius2=0.0:angle=0.0:min_points=0:nodata=0.0<br>
    possible metrics are:<br>
        minimum<br>
        maximum<br>
        range<br>
        count<br>
        average_distance<br>
        average_distance_pts<br>
<br>
FAILURE: Neither -sql nor -l are specified<br>
<br>
Note that it works in the terminal but it does not work in cron. Does anyone<br>
know what the problem is?<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html</a><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div>