diff --git a/package_check.sh b/package_check.sh index 079de9c..f32b5c8 100755 --- a/package_check.sh +++ b/package_check.sh @@ -193,7 +193,8 @@ then fi fi # Create the lock file -echo "start:$(date +%s)" > "$lock_file" +# $$ is the PID of package_check itself. +echo "start:$(date +%s):$$" > "$lock_file" #================================================= # Check the internet connectivity diff --git a/sub_scripts/lxc_force_stop.sh b/sub_scripts/lxc_force_stop.sh index 89ea77a..49b7a0a 100755 --- a/sub_scripts/lxc_force_stop.sh +++ b/sub_scripts/lxc_force_stop.sh @@ -11,6 +11,12 @@ LXC_NAME=$(cat "$pcheck_config" | grep LXC_NAME= | cut -d '=' -f2) LXC_BRIDGE=$(cat "$pcheck_config" | grep LXC_BRIDGE= | cut -d '=' -f2) main_iface=$(cat "$pcheck_config" | grep iface= | cut -d '=' -f2) +echo "> Arrêt de package_check" +# Kill package_check +# Retrieve the pid of Package check +package_check_pid="$(cat "$script_dir/../pcheck.lock" | cut -d: -f3)" +sudo kill --signal 15 $package_check_pid + echo "> Arrêt du conteneur" if [ $(sudo lxc-info --name $LXC_NAME | grep -c "STOPPED") -eq 0 ]; then echo "Arrêt du conteneur $LXC_NAME" @@ -39,3 +45,5 @@ then fi sudo lxc-ls -f + +sudo rm "$script_dir/../pcheck.lock" diff --git a/sub_scripts/testing_process.sh b/sub_scripts/testing_process.sh index 4d60579..51630ba 100644 --- a/sub_scripts/testing_process.sh +++ b/sub_scripts/testing_process.sh @@ -1455,7 +1455,8 @@ TEST_LAUNCHER () { stop_timer 2 # Update the lock file with the date of the last finished test. - echo "$1 $2:$(date +%s)" > "$lock_file" + # $$ is the PID of package_check itself. + echo "$1 $2:$(date +%s):$$" > "$lock_file" } set_witness_files () {