Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Squid - multiple instances of proxy_monitor.sh

    Scheduled Pinned Locked Moved pfSense Packages
    1 Posts 1 Posters 1.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      lsoltero
      last edited by

      Hello All,

      Today I did a ps on one our pfSense 1.2.3 boxes and saw 7 instances of proxy_monitor.sh.  We have been experimenting with DHCP on WAN and plugging and unplugging the ethernet cable to test it. It seems that when the DHCP lease expires and an new IP address is assigned to the WAN all the packages get resynced causing the a new instance of proxy_monitor.sh to be spawned.    This happens with both WAN and OPT1 when configured with DHCP.  I haven't explored this much but decided to add the following code to proxy_monitor.sh which causes it to exit if there is already an instance of the process running…

      Not sure if this is happening with 2.0.  In any event there should always only be one copy of proxy_monitor running. The code below prevents multiple instances for whatever reason. It might be a good idea to add this to the code base for unforeseen circumstances that might cause more than once instance of this to run.

      set -e

      PROXMONPID="/var/run/proxy_monitor_pid"

      is proxy_monitor.sh already running?

      if [ -f "$PROXMONPID" ] ; then
          oldpid=cat "$PROXMONPID"
          isrunning=(ps awux | grep "$oldpid" | grep -v "grep" | awk '{ print $2}')
          if [ -n "$isrunning" ]; then
              echo "$0 already running"
              exit
          fi
      fi

      echo -n $$ > "$PROXMONPID"

      LOOP_SLEEP=55

      and at the bottom of the file…

      if [ -f "$PROXMONPID" ] ; then
              rm "$PROXMONPID"
      fi

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.