<commit_before>#!/bin/bash
################################################
#
#              Generated by Chef
#
################################################

# this script is invoked on VIP change events via the vip_won/vip_lost symlinks
# (so that the appropriate initctl events are emitted)
SCRIPT_NAME=$(basename $0)

# detect if network flapping is spawning multiple instances of this script
if [ "$(pgrep -c $SCRIPT_NAME)" -gt "1" ]; then
  echo "$SCRIPT_NAME already running, exiting."
  exit 0
fi

# Restart the PowerDNS service
service pdns restart

# Restart local OpenStack services
/usr/local/bin/hup_openstack

# Generate an upstart event to notify anything that needs
# to take action on a vip change
initctl emit --no-wait $SCRIPT_NAME<commit_msg>Fixes #986 (maybe): try to lock PowerDNS restart to avoid multiple spawns<commit_after>#!/bin/bash
################################################
#
#              Generated by Chef
#
################################################

# this script is invoked on VIP change events via the vip_won/vip_lost symlinks
# (so that the appropriate initctl events are emitted)
SCRIPT_NAME=$(basename $0)

# detect if network flapping is spawning multiple instances of this script
if [ "$(pgrep -c $SCRIPT_NAME)" -gt "1" ]; then
  echo "$SCRIPT_NAME already running, exiting."
  exit 0
fi

# Restart the PowerDNS service, attempt to lock doing so to avoid
# multiple copies of PowerDNS starting up (see #986)
LOCK_FILE=/tmp/powerdns_restart.lock
if [ ! -f $LOCK_FILE ]; then
  echo $$ >> $LOCK_FILE
  service pdns restart
  rm -f $LOCK_FILE
fi

# Restart local OpenStack services
/usr/local/bin/hup_openstack

# Generate an upstart event to notify anything that needs
# to take action on a vip change
initctl emit --no-wait $SCRIPT_NAME
{'fraction_non_alphanumeric': 0.17837235228539577, 'fraction_numerical': 0.006688963210702341, 'mean_word_length': 4.6269592476489025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6021608', 'n_tokens_mistral': 539, 'n_tokens_neox': 505, 'n_words': 204}