Pi problems
Pi problems
Got everything working, but I can only feed the site if I ssh into the pi and manually run modes.jar (java -jar /livemodes/modes.jar). It won't run automatically at bootup and won't stay running once I close the secure shell connection.
Any suggestions?
Any suggestions?
Re: Pi problems
Just an update...
I can also run the modes.sh script manually using BASH, but Services will not run it. When I try to SERVICE MODES.SH START it will not run. I tried adding #!/bin/bash - to the top of modes.sh script, and it does nothing.
I can also run the modes.sh script manually using BASH, but Services will not run it. When I try to SERVICE MODES.SH START it will not run. I tried adding #!/bin/bash - to the top of modes.sh script, and it does nothing.
-
- Posts: 111
- Joined: Thu Apr 07, 2016 7:37 pm
Re: Pi problems
Hi ktul_fueler,
Did you make the script excecutable?
I made some modifications to the script. This works for me on RPI2 and RPI3 with jessie:
Did you make the script excecutable?
I made some modifications to the script. This works for me on RPI2 and RPI3 with jessie:
Code: Select all
#!/bin/bash
### BEGIN INIT INFO
# Provides: modes
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: modes initscript
### END INIT INFO
PROG="modes.jar"
PROG_PATH="/home/pi/livemodes"
PIDFILE="/var/run/modes.pid"
LOGFILE="/var/log/modes.log"
start() {
if [ -e $PIDFILE ]; then
## Program is running, exit with error.
echo "Error! $PROG is already running!" 1>&2
exit 1
else
## Change from /dev/null to something like /var/log/$PROG if you want to save ou$
cd $PROG_PATH
touch $LOGFILE
java -jar $PROG > $LOGFILE 2>$LOGFILE &
echo "$PROG started"
touch $PIDFILE
fi
}
stop() {
if [ -e $PIDFILE ]; then
## Program is running, so stop it
echo "$PROG is running, PIDFILE exists"
killall java
rm -f $PIDFILE
echo "$PROG stopped, PIDFILE deleted"
else
## Program is not running, exit with error.
echo "Error! $PROG not started! No PIDFILE found." 1>&2
exit 1
fi
}
## Found at http://www.cyberciti.biz/tips/shell-root-user-check-script.html
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
case "$1" in
start)
start
exit 0
;;
stop)
stop
exit 0
;;
reload|restart|force-reload)
stop
start
exit 0
;;
**)
echo "Usage: $0 {start|stop|reload}" 1>&2
exit 1
;;
esac
exit 0
Re: Pi problems
Now I have noticed another problem... the script/jar will run for several days, but eventually I will drop off the online locations page and will not be feeding (usually while I'm on days off away from the office!). When I remote in, the script is still running... thing go back to normal with a reboot, but any ideas of what I should look for?
-
- Posts: 111
- Joined: Thu Apr 07, 2016 7:37 pm
Re: Pi problems
Hello ktul_fueler,
check the output of the modes.jar by typing:
If there is something like "exception" ... "checked 3 times" ... "given up" then the program lost the connection to the SQL-database. It will not try again to connect. You can kill the program by:
and start again by:
check the output of the modes.jar by typing:
Code: Select all
cat /var/log/modes.log
Code: Select all
sudo service modes stop
Code: Select all
sudo service modes start
Re: Pi problems
Finally caught the error info:
Code: Select all
java.lang.NullPointerException
at foo.db.Logging_Current.main(Logging_Current.java:173)
Sep 24, 2016 8:48:12 AM foo.db.Logging_Current main
WARNING: null
java.lang.NullPointerException
at foo.db.Logging_Current.main(Logging_Current.java:173)
Sep 24, 2016 8:48:12 AM foo.db.Logging_Current main
SEVERE: null
java.lang.NullPointerException
at foo.db.Logging_Current.main(Logging_Current.java:173)
Sep 24, 2016 8:48:12 AM foo.db.Logging_Current main
INFO: Exception: Exc G: java.lang.NullPointerException
Sep 24, 2016 8:48:12 AM foo.db.Logging_Current main
INFO: java.lang.NullPointerException
Sep 24, 2016 8:48:12 AM foo.db.Logging_Current main
INFO:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:244)
at foo.db.Logging_Current.main(Logging_Current.java:135)
Sep 24, 2016 8:48:12 AM foo.db.Logging_Current main
INFO: IOException IO Exc F: java.net.ConnectException: Connection refused
Sep 24, 2016 8:48:12 AM foo.db.Logging_Current main
INFO: java.net.ConnectException: Connection refused
Sep 24, 2016 8:48:12 AM foo.db.Logging_Current main
INFO:
-
- Posts: 111
- Joined: Thu Apr 07, 2016 7:37 pm
Re: Pi problems
Hello ktul_fueler,
the first error (Null pointer in line 173) seems to be a bug in the "old" version of modes.jar. It tries to access element 17 (Squawk code) of an array, whose length was not checked before. Messages of type 7 (Air To Air Message) usually do not contain a Squawk field.
This version of modes.jar you are using is buggy. There are several more bugs in there. I recommend to use the new tool "modesfiltered.jar". You can find it in the forum under:
Board index - Joining this site - Help needed to test new reporting tool
There is also a short howto in this topic and you can find more info in the README.TXT file inside the Zip-File.
I am running the modesfiltered.jar without problems on two RPis since July 24/7.
Cheers
the first error (Null pointer in line 173) seems to be a bug in the "old" version of modes.jar. It tries to access element 17 (Squawk code) of an array, whose length was not checked before. Messages of type 7 (Air To Air Message) usually do not contain a Squawk field.
This version of modes.jar you are using is buggy. There are several more bugs in there. I recommend to use the new tool "modesfiltered.jar". You can find it in the forum under:
Board index - Joining this site - Help needed to test new reporting tool
There is also a short howto in this topic and you can find more info in the README.TXT file inside the Zip-File.
I am running the modesfiltered.jar without problems on two RPis since July 24/7.
Cheers
Re: Pi problems
Got the new modesfiltered program running, but getting errors on the log:
Code: Select all
format error
[MSG, 3, 1, 1, AC950B, 1, 2016/10/29, 14:17:40.585, 2016/10/29, 14:17:40.620, , 37000, , , , , , , , , , 0]
Executed com.mysql.jdbc.JDBC4PreparedStatement@97ab90: INSERT IGNORE INTO statusPI(HexCode, Location, Date ,Time, GMTTIME, squawk, Altitude) VALUES ('A86ACE','Tulsa OK, US','2016/10/29','10:17:31.461','10:17:31.461','7610','---')
Executed com.mysql.jdbc.JDBC4PreparedStatement@16e138: INSERT IGNORE INTO statusPI(HexCode, Location, Date ,Time, GMTTIME, squawk, Altitude) VALUES ('AD3C6D','Tulsa OK, US','2016/10/29','10:16:41.217','10:16:41.217','1172','---')
Executed com.mysql.jdbc.JDBC4PreparedStatement@fe7a9: INSERT IGNORE INTO liveidPI(hexcodeID, DateID, TimeID, CSID, Locatie) VALUES ('A69C61','2016/10/29','10:17:34.555','---','Tulsa OK, US')
Lat
format error
[MSG, 3, 1, 1, ABF2EA, 1, 2016/10/29, 14:17:48.183, 2016/10/29, 14:17:48.212, , 35350, , , , , , , , , , 0]
Lat
format error
[MSG, 3, 1, 1, ACDD1B, 1, 2016/10/29, 14:17:53.553, 2016/10/29, 14:17:53.566, , 34975, , , , , , , , , , 0]
Executed com.mysql.jdbc.JDBC4PreparedStatement@1b52810: UPDATE statusPI SET Altitude = '35000' where HexCode = 'A1804C'
Executed com.mysql.jdbc.JDBC4PreparedStatement@173555a: INSERT IGNORE INTO liveidPI(hexcodeID, DateID, TimeID, CSID, Locatie) VALUES ('ADA6D2','2016/10/29','10:17:45.029','---','Tulsa OK, US')