Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sous-chefs/mysql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: kcd83/mysql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 4 commits
  • 1 file changed
  • 1 contributor

Commits on May 19, 2015

  1. Cleaned up whitespace

    kcd83 committed May 19, 2015
    Copy the full SHA
    49d1dbd View commit details

Commits on May 20, 2015

  1. Handle stop timeout exit code and print message

    Obvious fix.
    kcd83 committed May 20, 2015
    Copy the full SHA
    101c170 View commit details
  2. Stop pending ellipsis and time out message

    Obvious fix.
    kcd83 committed May 20, 2015
    Copy the full SHA
    0f4da44 View commit details
  3. "Staring" typo

    Obvious fix.
    kcd83 committed May 20, 2015
    Copy the full SHA
    da921bd View commit details
Showing with 39 additions and 21 deletions.
  1. +39 −21 templates/default/sysvinit/mysqld.erb
60 changes: 39 additions & 21 deletions templates/default/sysvinit/mysqld.erb
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
####

STARTTIMEOUT=30
STOPTIMEOUT=15
STOPTIMEOUT=60

####
# Helper functions
@@ -42,9 +42,9 @@ pid_exists() {
PID_EXISTS=1
if [ -f <%= @pid_file %> ]; then
MYSQLD_PID=`cat <%= @pid_file %> 2>/dev/null`
if [ -n "$MYSQLD_PID" ] && [ -d "/proc/$MYSQLD_PID" ] ; then
PID_EXISTS=0
fi
if [ -n "$MYSQLD_PID" ] && [ -d "/proc/$MYSQLD_PID" ] ; then
PID_EXISTS=0
fi
fi
return $PID_EXISTS
}
@@ -64,9 +64,9 @@ running() {

writable_error_log() {
WRITABLE_ERROR_LOG=1
touch "<%= @error_log %>" 2>/dev/null
touch "<%= @error_log %>" 2>/dev/null
touchret=$?
if [ $touchret -eq 0 ]; then
if [ $touchret -eq 0 ]; then
chown <%= @config.run_user %>:<%= @config.run_group %> <%= @error_log %>
return 0
else
@@ -78,7 +78,7 @@ print_start_success() {
<% if node['platform_family'] == 'rhel' %>
action $"Starting <%= @mysql_name %>: " /bin/true
<% else %>
echo "Staring MySQL instance <%= @mysql_name %>"
echo "Starting MySQL instance <%= @mysql_name %>"
<% end %>
return 0;
}
@@ -110,11 +110,16 @@ print_reload_failure() {
return 0;
}

print_stopping() {
echo "Shutting down MySQL instance <%= @mysql_name %>"
return 0;
}

print_stop_success() {
<% if node['platform_family'] == 'rhel' %>
action $"Stopping <%= @mysql_name %>: " /bin/true
action $"Stopped <%= @mysql_name %>: " /bin/true
<% else %>
echo "Stopping MySQL instance <%= @mysql_name %>"
echo "MySQL instance <%= @mysql_name %> Stopped."
<% end %>
return 0;
}
@@ -177,16 +182,16 @@ start() {
break
fi
sleep 1
let TIMEOUT=${TIMEOUT}-1
let TIMEOUT=${TIMEOUT}-1
done

# Handle timeout
if [ $TIMEOUT -eq 0 ]; then
if [ $TIMEOUT -eq 0 ]; then
print_start_failure
# clean up
kill $start_pid 2>/dev/null
return 1
fi
return 1
fi

# successbaby.gif
print_start_success
@@ -219,24 +224,37 @@ status() {
# Stop <%= @mysql_name %>
stop() {
if running; then
echo "Stopping MySQL instance <%= @mysql_name %>"
print_stopping
if [ -f <%= @pid_file %> ]; then
/bin/kill `cat <%= @pid_file %> 2>/dev/null`
kstat=$?
ret=$?
fi

# Timeout loop
local TIMEOUT=$STARTTIMEOUT
local TIMEOUT=$STOPTIMEOUT
while [ $TIMEOUT -gt 0 ]; do
if [ -e <%= @pid_file %> ]; then
sleep 1
if [ ! -e <%= @pid_file %> ]; then
break
fi
let TIMEOUT=${TIMEOUT}-1
echo -n '.'
sleep 1
let TIMEOUT=${TIMEOUT}-1
done

return $kstat
# Handle timeout
if [ $TIMEOUT -eq 0 ]; then
echo -n ' timed out'
ret=1
fi

if [ $ret -eq 0 ]; then
print_stop_success;
else
print_stop_failure;
fi
return $ret
else
echo "MySQL instance <%= @mysql_name %> Stopped."
print_stop_success
return 0
fi
}