Skip to main content
Topic: mariadb initi script (Read 5315 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

mariadb initi script

I couldn't find one of these soo...

Code: [Select]
#!/usr/bin/openrc-run
# Distributed under the terms of the GNU General Public License v2

extra_commands="checkconfig"
extra_started_commands="reload"

: ${MARIABD_CONFDIR:=/etc/mysql}
: ${MARIABD_CONFIG:=${MARIABD_CONFDIR}/my.cnf}
: ${MARIABD_PIDFILE:=/run/mariadb/${SVCNAME}.pid}
: ${MARIABD_BINARY:=/usr/bin/mysqld_safe}

depend() {
        use logger dns
        if [ "${rc_need+set}" = "set" ] ; then
                : # Do nothing, the user has explicitly set rc_need
        else
                local x warn_addr
                for x in $(awk '/^ListenAddress/{ print $2 }' "$MARIABD_CONFIG" 2>/dev/null) ; do
                        case "${x}" in
                                0.0.0.0|0.0.0.0:*) ;;
                                ::|\[::\]*) ;;
                                *) warn_addr="${warn_addr} ${x}" ;;
                        esac
                done
                if [ -n "${warn_addr}" ] ; then
                        need net
                        ewarn "You are binding an interface in ListenAddress statement in your mariadbd_config!"
                        ewarn "You must add rc_need=\"net.FOO\" to your /etc/conf.d/mariadbd"
                        ewarn "where FOO is the interface(s) providing the following address(es):"
                        ewarn "${warn_addr}"
                fi
        fi
}

checkconfig() {
        if [ ! -d /var/empty ] ; then
                mkdir -p /var/empty || return 1
        fi

        if [ ! -e "${MARIABD_CONFIG}" ] ; then
                eerror "You need an ${MARIABD_CONFIG} file to run mariadbd"
                eerror "There is a sample file in /usr/share/doc/openmariadb"
                return 1
        fi


}

start() {
        checkconfig || return 1

        ebegin "Starting ${SVCNAME}"
        echo "PIDFILE ${MARIABD_PIDFILE}"
        start-stop-daemon --start --background --exec "${MARIABD_BINARY}"  --pidfile "${MARIABD_PIDFILE}"  -- ${MARIABD_OPTS}
        eend $?
}
stop() {
        if [ "${RC_CMD}" = "restart" ] ; then
                checkconfig || return 1
        fi

        ebegin "Stopping ${SVCNAME}"
        start-stop-daemon --stop --exec "${MARIABD_BINARY}" \
            --pidfile "${MARIABD_PIDFILE}" --quiet
        eend $?
}

reload() {
        checkconfig || return 1
        ebegin "Reloading ${SVCNAME}"
        start-stop-daemon --signal HUP \
            --exec "${MARIABD_BINARY}" --pidfile "${MARIABD_PIDFILE}"
        eend $?
}

Re: mariadb initi script

Reply #1
Mariadb is handled by the mysql-openrc package already present in the world repo

Re: mariadb initi script

Reply #2
this last upgrade seems to have again just ignored my instructions to not override my /etc/init.d/ file or even my safe_mysqld file.

It also creates a mysqld user I don't want and messes up the /var/run directory... every time.

Re: mariadb initi script

Reply #3
BTW - there seems to be a change in    #!/usr/bin/openrc-run


I needed to /etc/init.d/service zap once openrc lost track of a serivce that crashes

Re: mariadb initi script

Reply #4
this last upgrade seems to have again just ignored my instructions to not override my /etc/init.d/ file or even my safe_mysqld file.

It also creates a mysqld user I don't want and messes up the /var/run directory... every time.

I find that hard to believe, unless you post your full /etc/pacman.conf.

Re: mariadb initi script

Reply #5
Code: [Select]

#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
#CacheDir    = /var/cache/pacman/pkg/
#LogFile     = /var/log/pacman.log
#GPGDir      = /etc/pacman.d/gnupg/
#HookDir     = /etc/pacman.d/hooks/
HoldPkg     = pacman glibc
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta    = 0.7
Architecture = auto

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg   =
IgnorePkg   = perl
#IgnoreGroup =

#NoUpgrade   =
#NoExtract   =
NoExtract   = /etc/mysql/my.cnf
NoExtract   = /usr/bin/mysqld_safe
NoExtract   = /etc/init.d/mariadb
NoExtract   = /etc/runlevels/default/mariadb
NoExtract   = /usr/lib/sysusers.d/mariadb.conf
NoExtract   = /usr/lib/tmpfiles.d/mariadb.conf
NoExtract   = /usr/share/vim/vim80/defaults.vim


# Misc options
#UseSyslog
#Color
#TotalDownload
CheckSpace
#VerbosePkgLists

# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required

# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Cromnix
# packagers with `pacman-key --populate archlinux cromnix`.
#
# REPOSITORIES
#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - local/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#   - URLs will have $repo replaced by the name of the current repo
#   - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.

[system-testing]
Include = /etc/pacman.d/mirrorlist

[system]
Include = /etc/pacman.d/mirrorlist

[world]
Include = /etc/pacman.d/mirrorlist

#[world-testing]
#Include = /etc/pacman.d/mirrorlist

[galaxy]
Include = /etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist-arch

#[multilib]
#Include = /etc/pacman.d/mirrorlist-arch

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

#[core]
#Include = /etc/pacman.d/mirrorlist-arch

[extra]

[community]
Include = /etc/pacman.d/mirrorlist-arch


Re: mariadb initi script

Reply #6
CODE brackets pleaaaaseeee!!!!!!!!

Re: mariadb initi script

Reply #7
As I suspected, your config is wrong. 'NoExtract' uses relative paths, not absolute, because only a Sith deals in absolutes.

Code: [Select]
NoExtract   = etc/mysql/my.cnf

 

Re: mariadb initi script

Reply #8
As I suspected, your config is wrong. 'NoExtract' uses relative paths, not absolute, because only a Sith deals in absolutes.

Code: [Select]
NoExtract   = etc/mysql/my.cnf

well the sith aint boure shell scripters...

what is the relative root then?
That is like a non-rooted tarball?


Re: mariadb initi script

Reply #10
there is no longer a safe_mysqld so this needs an adjustment now.

Re: mariadb initi script

Reply #11
how do I get the run tmp files to build correctly?

Re: mariadb initi script

Reply #12
Code: [Select]
#!/usr/bin/openrc-run
# Distributed under the terms of the GNU General Public License v2
echo "Hello"
#extra_commands="checkconfig"
#extra_started_commands="reload"

: ${MARIABD_CONFDIR:=/etc/mysql}
: ${MARIABD_CONFIG:=${MARIABD_CONFDIR}/my.cnf}
: ${MARIABD_OPTS:='user=maria'}
: ${MARIABD_PIDFILE:=/run/mariadb/${SVCNAME}.pid}
#: ${MARIABD_BINARY:=/usr/bin/mysqld_safe_helper}}
: ${MARIABD_BINARY:=/usr/bin/mysqld}

        echo "PIDFILE ${MARIABD_PIDFILE}"
depend() {
        use logger dns
        if [ "${rc_need+set}" = "set" ] ; then
                : # Do nothing, the user has explicitly set rc_need
        else
                local x warn_addr
                for x in $(awk '/^ListenAddress/{ print $2 }' "$MARIABD_CONFIG" 2>/dev/null) ; do
                        case "${x}" in
                                0.0.0.0|0.0.0.0:*) ;;
                                ::|\[::\]*) ;;
                                *) warn_addr="${warn_addr} ${x}" ;;
                        esac
                done
                if [ -n "${warn_addr}" ] ; then
                        need net
                        ewarn "You are binding an interface in ListenAddress statement in your mariadbd_config!"
                        ewarn "You must add rc_need=\"net.FOO\" to your /etc/conf.d/mariadbd"
                        ewarn "where FOO is the interface(s) providing the following address(es):"
                        ewarn "${warn_addr}"
                fi
        fi
}

checkconfig() {
        if [ ! -d /var/empty ] ; then
                mkdir -p /var/empty || return 1
        fi

        if [ ! -e "${MARIABD_CONFIG}" ] ; then
                eerror "You need an ${MARIABD_CONFIG} file to run mariadbd"
                eerror "There is a sample file in /usr/share/doc/openmariadb"
                return 1
        fi

}

start() {
        checkconfig || return 1

        ebegin "Starting ${SVCNAME}"
        echo "PIDFILE ${MARIABD_PIDFILE}"
        echo "Command ${MARIABD_BINARY}  --pidfile ${MARIABD_PIDFILE} --${MARIABD_OPTS}"
        start-stop-daemon --start --background --exec "${MARIABD_BINARY}"  --pidfile "${MARIABD_PIDFILE}"  --${MARIABD_OPTS}
        eend $?
}

stop() {
        if [ "${RC_CMD}" = "restart" ] ; then
                checkconfig || return 1
        fi

        ebegin "Stopping ${SVCNAME}"
        start-stop-daemon --stop --exec "${MARIABD_BINARY}" \
            --pidfile "${MARIABD_PIDFILE}" --quiet
        eend $?
}

reload() {
        checkconfig || return 1
        ebegin "Reloading ${SVCNAME}"
        start-stop-daemon --signal HUP \
            --exec "${MARIABD_BINARY}" --pidfile "${MARIABD_PIDFILE}"
        eend $?
}



Re: mariadb initi script

Reply #13
There is one thing that keeps cropping up with this.  When updates are made the darn /run tmp files are wiped out of the configuration of the system.  Can't this be fixed?