Skip to content

Instantly share code, notes, and snippets.

@anthonyryan1
Last active April 26, 2018 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonyryan1/71a57772bc52b6e70dff7f1a8a2afeeb to your computer and use it in GitHub Desktop.
Save anthonyryan1/71a57772bc52b6e70dff7f1a8a2afeeb to your computer and use it in GitHub Desktop.
--- a/files/init.d-2.2 2018-04-26 10:56:44.452592421 -0400
+++ b/files/init.d-2.2 2018-04-26 11:55:20.408548260 -0400
@@ -74,6 +74,7 @@
fi
# tail -n1 is critical as these we only want the last instance of the option
+ local user=$(get_config "${MY_CNF}" user | tail -n1)
local basedir=$(get_config "${MY_CNF}" basedir | tail -n1)
local pidfile=$(get_config "${MY_CNF}" pid-file | tail -n1)
local socket=$(get_config "${MY_CNF}" socket | tail -n1)
@@ -113,7 +114,7 @@
fi
local piddir="${pidfile%/*}"
- checkpath -d --owner mysql:mysql --mode 0755 "$piddir"
+ checkpath -d --owner "${user}" --mode 0755 "$piddir"
rc=$?
if [ $rc -ne 0 ]; then
eerror "Directory $piddir for pidfile does not exist and cannot be created"
@@ -127,6 +128,7 @@
start-stop-daemon \
${DEBUG:+"--verbose"} \
--start \
+ --user "${user}" \
--exec "${basedir}"/sbin/mysqld \
--pidfile "${pidfile}" \
--background \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment