Skip to content

Commit 2155537

Browse files
committed
use pid script wherever possible
Signed-off-by: Michel-FK <[email protected]>
1 parent 04570f0 commit 2155537

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

FunKey/board/funkey/rootfs-overlay/usr/local/sbin/assembly_tests

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ touch ${LOCK_FILE}
1818

1919
## Register ourself as the running FunKey task for receiving USR1
2020
## signal for shutting down
21-
echo $$ > "/var/run/funkey.pid"
21+
pid record $$
2222

2323
## Binaries
2424
PROD_SCREEN_BIN="/usr/local/sbin/funkey_prod_screens"
@@ -224,7 +224,7 @@ function launch_tests_up_until_magnet {
224224

225225
## Register ourself back as the running FunKey task for receiving USR1
226226
## signal for shutting down
227-
echo $$ > "/var/run/funkey.pid"
227+
pid record $$
228228

229229
# check magnet test result
230230
if [[ "$res" == "0" ]]; then

FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#set -x
55

66
SELF="$(basename ${0})"
7-
PID_FILE="/var/run/funkey.pid"
87
PID_PATH="/var/run/pid_path"
98
REBOOTING_FILE="/run/rebooting"
109

@@ -19,12 +18,12 @@ schedule_powerdown() {
1918

2019
# Save current pid path before closing bin
2120
# (won't work if bin is already closed)
22-
pid_path=$(dirname $(readlink /proc/$(pid print)/exe))
23-
echo -n "$pid_path" > "$PID_PATH"
21+
local pid_path=$(dirname $(readlink /proc/$(pid print)/exe))
22+
echo -n "${pid_path}" > "${PID_PATH}"
2423

2524
# Send USR1 signal to the running FunKey process to warn about
2625
# impending shutdown
27-
pkill -USR1 -F "${PID_FILE}" > /dev/null 2>&1
26+
pkill -USR1 "$(pid print)" > /dev/null 2>&1
2827

2928
# Delay for the given grace period seconds to catch signal USR2.
3029
# If the signal is caught, then it means the running FunKey

0 commit comments

Comments
 (0)