mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
use lock_file var
This commit is contained in:
parent
8e663a1142
commit
5d9a022a1f
1 changed files with 4 additions and 4 deletions
|
@ -39,7 +39,7 @@ function parse_args() {
|
||||||
local getopts_built_arg=()
|
local getopts_built_arg=()
|
||||||
|
|
||||||
# Read the array value per value
|
# Read the array value per value
|
||||||
for i in `seq 0 $(( ${#arguments[@]} -1 ))`
|
for i in $(seq 0 $(( ${#arguments[@]} -1 )))
|
||||||
do
|
do
|
||||||
if [[ "${arguments[$i]}" =~ "--branch=" ]]
|
if [[ "${arguments[$i]}" =~ "--branch=" ]]
|
||||||
then
|
then
|
||||||
|
@ -132,7 +132,7 @@ function cleanup()
|
||||||
|
|
||||||
if [[ $force_stop == 1 ]]
|
if [[ $force_stop == 1 ]]
|
||||||
then
|
then
|
||||||
package_check_pid="$(cat "./pcheck.lock" 2> /dev/null | cut -d: -f3)"
|
package_check_pid="$(cat $lock_file 2> /dev/null | cut -d: -f3)"
|
||||||
if [ -n "$package_check_pid" ]; then
|
if [ -n "$package_check_pid" ]; then
|
||||||
kill -15 $package_check_pid
|
kill -15 $package_check_pid
|
||||||
fi
|
fi
|
||||||
|
@ -145,7 +145,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# If the lock file exist and corresponding process still exists
|
# If the lock file exist and corresponding process still exists
|
||||||
if test -e "$lock_file" && ps --pid "$(cat pcheck.lock | cut -d: -f3)" | grep --quiet "$(cat pcheck.lock | cut -d: -f3)"
|
if test -e "$lock_file" && ps --pid "$(cat $lock_file | cut -d: -f3)" | grep --quiet "$(cat $lock_file | cut -d: -f3)"
|
||||||
then
|
then
|
||||||
if [ $interactive -eq 1 ]; then
|
if [ $interactive -eq 1 ]; then
|
||||||
echo "The lock file $lock_file already exists."
|
echo "The lock file $lock_file already exists."
|
||||||
|
@ -168,7 +168,7 @@ echo "start:$(date +%s):$$" > "$lock_file"
|
||||||
#==========================
|
#==========================
|
||||||
# Cleanup
|
# Cleanup
|
||||||
# N.B. the traps are added AFTER the lock is taken
|
# N.B. the traps are added AFTER the lock is taken
|
||||||
# because we don't want to mess with with the lock and LXC
|
# because we don't want to mess with the lock and LXC
|
||||||
# it we ain't the process with the lock...
|
# it we ain't the process with the lock...
|
||||||
#==========================
|
#==========================
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue