Thread: [Fremantle Maemo5+Harmattan Maemo6] [Announce] gpscon gps position cli shell console
View Single Post
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#27
Originally Posted by Halftux View Post
Please start your script in cron like this: "sh gps.sh".
This could solve your issue.
Why did I not think of that myself?

Sadly, no
Code:
[nemo@Dinghy ~]$ ps ax | grep gps
  457 ?        Ss     0:00 /bin/sh ./gpsconupload
  458 ?        S      0:00 /bin/sh ./gpsconupload
  459 ?        S      0:00 gpscon --script runs=3
 1221 ?        Ss     0:00 /bin/sh ./gpsconupload
 1222 ?        S      0:00 /bin/sh ./gpsconupload
 1224 ?        S      0:00 gpscon --script runs=3
 1306 pts/0    S+     0:00 grep gps
[nemo@Dinghy ~]$
I have no idea where the double entries (pid 457/458 and 1221/1222) come from.

For a reference, I have made only a minimal change to the script.
Adding --script and replacing curl with echo:
Code:
#!/bin/sh

STR=`gpscon --script runs=3 | tail -n 1`

LAT=`echo $STR | cut -d " " -f 2 | cut -d ";" -f 1`
LON=`echo $STR | cut -d " " -f 4 | cut -d ";" -f 1`
ALT=`echo $STR | cut -d " " -f 6`

STR={\"gid\":\"`hostname`\",\"time\":`date +%s`,\"lon\":$LON,\"lat\":$LAT
if [ $ALT != "nan" ]; then
  STR=$STR,\"alt\":$ALT
fi
STR=$STR}

echo $STR >> ~/gpsconlog.txt
I have also tried splitting it in two files. The file evoked by cron has only the following:
Code:
#!/bin/sh

sh ./gpsconupload.do
That did not help either:
Code:
[nemo@Dinghy ~]$ ps ax | grep gps
 3871 ?        Ss     0:00 sh ./gpsconupload
 3872 ?        S      0:00 sh ./gpsconupload.do
 3873 ?        S      0:00 sh ./gpsconupload.do
 3874 ?        S      0:00 gpscon --script runs=3
 4076 ?        Ss     0:00 sh ./gpsconupload
 4077 ?        S      0:00 sh ./gpsconupload.do
 4078 ?        S      0:00 sh ./gpsconupload.do
 4079 ?        S      0:00 gpscon --script runs=3
 4088 pts/0    S+     0:00 grep gps
[nemo@Dinghy ~]$
Note again the double entries. They cannot be explained by a bug in or a misconfiguration of cron since cron launches only sh ./gpsconupload, which in turn runs the .do file. Any idea what's going on here?
__________________
Русский военный корабль, иди нахуй!
 

The Following User Says Thank You to pichlo For This Useful Post: