mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
changes to startup script
This commit is contained in:
parent
7014d1c2d2
commit
73955f8b03
3 changed files with 19 additions and 8 deletions
|
@ -286,6 +286,7 @@ class fsmPev():
|
||||||
self.sessionId = strSessionId
|
self.sessionId = strSessionId
|
||||||
except:
|
except:
|
||||||
self.addToTrace("ERROR: Could not decode the sessionID")
|
self.addToTrace("ERROR: Could not decode the sessionID")
|
||||||
|
|
||||||
if ((strResponseCode!="OK_NewSessionEstablished") and (strResponseCode!="OK")):
|
if ((strResponseCode!="OK_NewSessionEstablished") and (strResponseCode!="OK")):
|
||||||
# According to the standard, the only valid response code is OK_NewSessionEstablished.
|
# According to the standard, the only valid response code is OK_NewSessionEstablished.
|
||||||
# But the ABB chargers use "OK", so we need to accept this, too. Discussed
|
# But the ABB chargers use "OK", so we need to accept this, too. Discussed
|
||||||
|
|
|
@ -12,8 +12,8 @@ from time import sleep, time
|
||||||
from configmodule import getConfigValue, getConfigValueBool
|
from configmodule import getConfigValue, getConfigValueBool
|
||||||
import sys # For exit_on_session_end hack
|
import sys # For exit_on_session_end hack
|
||||||
|
|
||||||
PinCp = "P8_18"
|
PinCp = "P9_41"
|
||||||
PinPowerRelay = "P8_16"
|
PinPowerRelay = "P9_17"
|
||||||
|
|
||||||
if (getConfigValue("digital_output_device")=="beaglebone"):
|
if (getConfigValue("digital_output_device")=="beaglebone"):
|
||||||
# In case we run on beaglebone, we want to use GPIO ports.
|
# In case we run on beaglebone, we want to use GPIO ports.
|
||||||
|
|
22
starter.sh
22
starter.sh
|
@ -39,9 +39,11 @@ sysctl net.ipv6.conf.eth0.keep_addr_on_down=1
|
||||||
# Todo: Why this needed? On raspberry, where the NetworkManager is not runnning, this disturbs, because
|
# Todo: Why this needed? On raspberry, where the NetworkManager is not runnning, this disturbs, because
|
||||||
# afterwards the pyPlc does not see the interfaces IPv6 address.
|
# afterwards the pyPlc does not see the interfaces IPv6 address.
|
||||||
# Todo: make this configurable, for the cases we need this.
|
# Todo: make this configurable, for the cases we need this.
|
||||||
# ip link set eth0 down
|
ip link set eth0 down
|
||||||
|
ip link set can0 down
|
||||||
sleep 1
|
sleep 1
|
||||||
# ip link set eth0 up
|
ip link set eth0 up
|
||||||
|
ip link set can0 up type can restart-ms 100 bitrate 500000
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# show the addresses
|
# show the addresses
|
||||||
|
@ -53,17 +55,25 @@ pwd
|
||||||
# create directory for the log files.
|
# create directory for the log files.
|
||||||
mkdir -p log
|
mkdir -p log
|
||||||
# prepare the file names for the log files
|
# prepare the file names for the log files
|
||||||
|
pushd log
|
||||||
|
gzip *.log || true
|
||||||
|
popd
|
||||||
date=$(date "+%Y-%m-%d_%H%M%S")
|
date=$(date "+%Y-%m-%d_%H%M%S")
|
||||||
logfile=./log/"$date"_pevNoGui.log
|
#logfile=./log/"$date"_pevNoGui.log
|
||||||
tcpdump_logfile=./log/"$date"_tcpdump.pcap
|
#logfile=./log/pevNoGui.log
|
||||||
|
index=`cat log/logindex`
|
||||||
|
logfile=`printf "log/%04d_pevNoGui.log" $index`
|
||||||
|
tcpdump_logfile=`printf "log/%04d_tcpdump.pcap" $index`
|
||||||
|
index=$(($index + 1))
|
||||||
|
echo $index > log/logindex
|
||||||
|
|
||||||
echo "logfile: $logfile"
|
echo "logfile: $logfile"
|
||||||
echo "tcpdump_logfile: $tcpdump_logfile"
|
echo "tcpdump_logfile: $tcpdump_logfile"
|
||||||
|
|
||||||
# start the tcpdump
|
# start the tcpdump
|
||||||
start_tcpdump "$tcpdump_logfile"
|
#start_tcpdump "$tcpdump_logfile"
|
||||||
|
|
||||||
echo "$date" >> "$logfile"
|
echo "$date" > "$logfile"
|
||||||
git log --oneline -1 >> "$logfile" || echo "Not a git repo" >> "$logfile"
|
git log --oneline -1 >> "$logfile" || echo "Not a git repo" >> "$logfile"
|
||||||
ip addr >> "$logfile"
|
ip addr >> "$logfile"
|
||||||
pwd >> "$logfile"
|
pwd >> "$logfile"
|
||||||
|
|
Loading…
Reference in a new issue