I have two scripts that work perfectly from the command line but don’t work in crontab. The scripts are for requesting a GRIB weather file via email. The script looks in the email out box folder for an existing request and deletes it if it exists. It then gets gps data and makes the new request based on the gps location at the time of the request. A new request is generated and put in the out box folder.
here is one of the scripts
#! /bin/bash # checking for existing requests R=$(grep -l "Grib" /user/.wl2k/mailbox/email-user/out/*.b2f) if ( -n "$R" ) then rm $R fi #get GPS cordinates Lat/Lon X=$(gpspipe -w -n 10 |grep lat|tail -n1|cut -d":" -f9|cut -d"," -f1) Y=$(gpspipe -w -n 10 |grep lon|tail -n1|cut -d":" -f10|cut -d"," -f1) # adding + or - 25 to longitude, and + or -12 to latitude A=$(echo "scale=4; $X+12" | bc -l) B=$(echo "scale=4; $X-12" | bc -l) C=$(echo "scale=4; $Y-25" | bc -l) D=$(echo "scale=4; $Y+25" | bc -l) # Sending the GRIB request to pat (this is for weather) curl http://localhost:8080/api/mailbox/out -F "date=$(date -u +'%Y-%m-%dT%H:%M:> |2,2|6,12..96|PRESS,WIND,GUST,= CAPE,RAIN,CLOUDS,AIRTMP,WAVES"