mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-16 08:01:59 +01:00
chromium-os:17680 : Establish Syncer PID file invariants
Details
This change updates the use of '-s' to have the proper polarity to
see if the syncer PID file is zero bytes in size.
As a bit of other cleanup, if a file of size zero is found, it's
removed. This allows the second size test of the syncer PID file to
be removed.
Testing
o Created zero-length PID file: saw warning message on console. Saw
that the file contains a valid pin while the chroot is entered,
and verified the PID file is deleted after exiting chroot.
INFO : You may have suffered from chromium-os:17680 and
INFO : could have stray 'enter_chroot.sh' processes running.
INFO : Erroneous PID file will be cleaned up.
o Entered chroot with multiple terminals, saw that the PID file is
removed & the syncer process is killed when the last client exits
the chroot.
o Executed './enter_chroot.sh --verbose', changed ownership of PID file to
'root'.
Exited and did not see the following diagnostic message:
INFO : Unable to clean up syncer process.
The message should not be printed because the file is removed
under 'sudo'.
BUG=chromium-os:17680
TEST=See above.
Signed-off-by: Taylor Hutt <thutt@chromium.org>
Change-Id: I055fe72b9322acee8c774401b3452ef502b30970
Reviewed-on: http://gerrit.chromium.org/gerrit/4936
Tested-by: Taylor Hutt <thutt@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
This commit is contained in:
parent
09e87bca4f
commit
18594a87ba
@ -217,15 +217,15 @@ function setup_env {
|
||||
# restart.
|
||||
#
|
||||
# The daemon is killed by the enter_chroot that exits last.
|
||||
if [ -f "${SYNCERPIDFILE}" ] && [ -s "${SYNCERPIDFILE}" ] ; then
|
||||
if [ -f "${SYNCERPIDFILE}" ] && [ ! -s "${SYNCERPIDFILE}" ] ; then
|
||||
info "You may have suffered from chromium-os:17680 and";
|
||||
info "could have stray 'enter_chroot.sh' processes running.";
|
||||
info "You must manually kill any such stray processes.";
|
||||
info "Exit all chroot shells; remaining 'enter_chroot.sh'";
|
||||
info "processes are probably stray.";
|
||||
sudo rm -f "${SYNCERPIDFILE}";
|
||||
fi;
|
||||
if ! [ -f "${SYNCERPIDFILE}" ] || \
|
||||
[ -s "${SYNCERPIDFILE}" ] || \
|
||||
! [ -d /proc/$(cat "${SYNCERPIDFILE}") ]; then
|
||||
debug "Starting sync process"
|
||||
env_sync_proc &
|
||||
@ -387,7 +387,7 @@ function teardown_env {
|
||||
# starting the syncer process when this occurs by deleting the
|
||||
# PID file.
|
||||
kill $(cat "${SYNCERPIDFILE}") && \
|
||||
rm -f "${SYNCERPIDFILE}" || \
|
||||
sudo rm -f "${SYNCERPIDFILE}" || \
|
||||
debug "Unable to clean up syncer process.";
|
||||
|
||||
MOUNTED_PATH=$(readlink -f "$FLAGS_chroot")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user