Thread: [Fremantle Maemo5+Harmattan Maemo6] [Announce] gpscon gps position cli shell console
View Single Post
Halftux's Avatar
Posts: 862 | Thanked: 2,511 times | Joined on Feb 2012 @ Germany
#28
Originally Posted by pichlo View Post

I have no idea where the double entries (pid 457/458 and 1221/1222) come from.

Any idea what's going on here?
No sorry I don't know Could be the shell from cron
Here a link to start with another shell. What shell does sailfish use?

Cron has several enviromental variables configured in /etc/crontab, specifically SHELL and PATH. The default value for SHELL is /bin/sh. So unless this is changed or otherwise specified in a script, cron will execute commands using sh.

Here is my scenario with N900.

In alarmed I write as command:
Code:
sh /opt/gps.sh
gps.sh
Code:
#!/bin/sh

gpscon runs=3 --script > /home/user/MyDocs/gps2.txt
or
Code:
#!/bin/sh

STR=`gpscon runs=3 --script`

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={\"name\":\"`hostname`\",\"time\":`date +%s`,\"lon\":$LON,\"lat\":$LAT
echo $STR > /home/user/MyDocs/gps2.log
running without a problem with alarmed. If you not put sh infront it will not work.

Code:
14554 user      2084 S    /bin/ash -c sh /opt/gps.sh 
14555 user      2084 S    sh /opt/gps.sh 
14556 user     27632 S    gpscon runs=3 --script 
14560 user      2088 S    grep gps
Now comes the funny thing doesn't matter with or without cron.
When in the location settings the location supl. server is deactivated or when using posm=onlysat is set, there will be no output unless you have enough satellites in view.

Last edited by Halftux; 2016-02-29 at 18:53. Reason: added text in quotes
 

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