Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Achim Morschhauser
GeomagLogger
Commits
22ae1ef4
Commit
22ae1ef4
authored
Jul 30, 2019
by
Tobias Bjerg
Browse files
Mainly START to kill children
parent
2090b7d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
usr/START
View file @
22ae1ef4
#!/bin/bash
DIR_BASE
=
/home/
mors/WORK/PROJEKTE/Datenl
ogger/
GIT/
DIR_BASE
=
/home/
odaq/GeomagL
ogger/
# Paramters file
PAR_FILE
=
$DIR_BASE
\u
sr/par
/parameters.par
PAR_FILE
=
/home/odaq
/parameters.par
# Directory with executables
DIR_BIN
=
$DIR_BASE
\b
in
/
PATH
=
$PATH
:
$DIR_BIN
# Read parameters file
source
$PAR_FILE
#MYPID=$$
# Check if remote directoy is mounted,
# and mount if necessry
mounted
=
$(
cat
/etc/mtab |
grep
$DIR_VAR
)
#echo $MYPID > /home/odaq/pidfile
if
[
-z
"
$mounted
"
]
;
then
mount
$DIR_VAR
fi
# Kill all subprocesses when parent dies
#trap 'echo "HELLO: TEST" > /home/odaq/TEST; killall Stream_Reader; killall OBSDAQ_Logger' SIGHUP SIGINT SIGQUIT SIGTERM SIGPIPE TERM EXIT SIGCHLD SIGTSTP SIGBUS SIGABRT SIGTAP SIGILL
function
killit
{
PIDs
=
$(
pgrep
-P
$MYPID
)
for
p
in
$PIDs
;
do
pkill
-P
$p
;
done
}
# Read parameters file
source
$PAR_FILE
# Create logging directory
mkdir
-p
$DIR_LOG
# Start data acquisition
#OBSDAQ_Logger $PAR_FILE
OBSDAQ_Logger
$PAR_FILE
2>
$DIR_LOG
/OBSDAQ.log | Stream_Reader
$PAR_FILE
{
trap
'kill 0'
EXIT
;
OBSDAQ_Logger
$PAR_FILE
2>
$DIR_LOG
/OBSDAQ.log
;
pkill
-g
0
;
}
|
{
trap
'kill 0'
EXIT
;
Stream_Reader
$PAR_FILE
;
pkill
-g
0
;
}
#(OBSDAQ_Logger $PAR_FILE 2> $DIR_LOG/OBSDAQ.log && pkill -g 0) | { Stream_Reader $PAR_FILE; pkill -g 0; }
#{ (OBSDAQ_Logger $PAR_FILE $DIR_LOG/OBSDAQ.log | Stream_Reader $PAR_FILE); pkill -P $MYPID; }
# Some attempts to kill all from child process
#PID=$!
#PIDs=$(pgrep -P $PID)
#PID_O=$(pidof OBSDAQ_Logger)
#PID_S=$(pidof Stream_Reader)
#echo "TEST: " $PIDs > /home/odaq/TEST
#wait $!
usr/src/OBSDAQ_Logger.cpp
View file @
22ae1ef4
...
...
@@ -57,7 +57,7 @@ int main(int argc, char* argv[]) {
// Initialize the calibration constants for FGE
Obs_Calibration_Vector
cal
=
Obs_Calibration_Vector
(
X_s
/
R
,
Y_s
/
R
,
Z_s
/
R
);
// Initialize the calibration constants for ObsDAQ
cal
.
set_adc_calibrate
(
"usr/par/ADC.par"
);
cal
.
set_adc_calibrate
(
par
.
get_str
(
"FILE_ADC_CONFIG"
)
);
// Initialize new OBSDAQ device
driver_obs_obsdaq
obsdaq
=
driver_obs_obsdaq
(
par
.
get_str
(
"PORT"
),
...
...
usr/src/Serial_Talk.cpp
View file @
22ae1ef4
...
...
@@ -21,7 +21,7 @@ int main(){
std
::
cerr
<<
"BAUD: "
;
std
::
cin
>>
baud
;
driver_serial
serial
=
driver_serial
(
"/dev/
ttyUSB0
"
,
term
,
1
,
baud
);
driver_serial
serial
=
driver_serial
(
"/dev/
OBSDAQ
"
,
term
,
1
,
baud
);
while
(
1
){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment