diff options
author | Renato Botelho <garga@FreeBSD.org> | 2017-04-24 16:34:34 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2017-04-24 17:06:50 -0300 |
commit | c065109bae038a1b544b728ecab29da0bab5e715 (patch) | |
tree | 39093a57cc30a8d944b594cdf29f969e92833df9 | |
parent | 33545c0a3e125a1a09aac5686497f1f69af5c7b1 (diff) | |
download | FreeBSD-ports-c065109bae038a1b544b728ecab29da0bab5e715.zip FreeBSD-ports-c065109bae038a1b544b728ecab29da0bab5e715.tar.gz |
Create PID file just after check was executed to reduce a possible race
-rwxr-xr-x | sysutils/pfSense-upgrade/files/pfSense-upgrade | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sysutils/pfSense-upgrade/files/pfSense-upgrade b/sysutils/pfSense-upgrade/files/pfSense-upgrade index d345bf6..258fa26 100755 --- a/sysutils/pfSense-upgrade/files/pfSense-upgrade +++ b/sysutils/pfSense-upgrade/files/pfSense-upgrade @@ -1097,6 +1097,13 @@ if pgrep -qF ${pid_file} >/dev/null 2>&1; then exit 1 fi +echo $$ > ${pid_file} + +# Since this point it's safe to remove pid_file +delete_pid=1 + +trap _exit 1 2 15 EXIT + if [ -z "${booting}" -o "${boot_stage}" != "2" ]; then /usr/local/bin/php /etc/rc.conf_mount_rw fi @@ -1105,13 +1112,6 @@ if [ -n "${booting}" ]; then export REPO_AUTOUPDATE=false fi -echo $$ > ${pid_file} - -# Since this point it's safe to remove pid_file -delete_pid=1 - -trap _exit 1 2 15 EXIT - if [ "${action}" != "upgrade" -a -f "${logfile}" ]; then rm -f ${logfile} fi |