diff options
author | Ermal LUÇI <eri@pfsense.org> | 2014-11-24 19:59:55 +0100 |
---|---|---|
committer | Ermal LUÇI <eri@pfsense.org> | 2014-11-24 19:59:55 +0100 |
commit | 5987261f1a5eba83e5bcec740fd8ebdb593ddf82 (patch) | |
tree | cc50ed9ab1a81032bef208b62898fbc0d8c91b5d /etc/rc.start_packages | |
parent | c2847e0faa781712f6419c8f305c97df66d9d233 (diff) | |
download | pfsense-5987261f1a5eba83e5bcec740fd8ebdb593ddf82.zip pfsense-5987261f1a5eba83e5bcec740fd8ebdb593ddf82.tar.gz |
Use the same strategy as on CP by putting a file to detect running instances and if older than 90seconds continue otherwise just let the previous one continue.
Diffstat (limited to 'etc/rc.start_packages')
-rwxr-xr-x | etc/rc.start_packages | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/etc/rc.start_packages b/etc/rc.start_packages index 4ddd908..37be693 100755 --- a/etc/rc.start_packages +++ b/etc/rc.start_packages @@ -38,6 +38,18 @@ require_once("pkg-utils.inc"); require_once("pfsense-utils.inc"); require_once("service-utils.inc"); +if (file_exists("{$g['tmp_path']}/.rc.start_packages.running")) { + $stat = stat("{$g['tmp_path']}/.rc.start_packages.running"); + if (time() - $stat['mtime'] >= 90) + @unlink("{$g['tmp_path']}/.rc.start_packages.running"); + else { + log_error("Skipping STARTing packages process because previous/another instance is already running"); + return; + } +} + +@file_put_contents("{$g['tmp_path']}/.rc.start_packages.running", ""); + log_error("Restarting/Starting all packages."); $rcfiles = glob(RCFILEPREFIX . "*.sh"); @@ -71,4 +83,5 @@ if ($shell) { pclose($shell); } +@unlink("{$g['tmp_path']}/.rc.start_packages.running"); ?> |