Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Systemd help needed please.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Thistled
Guru
Guru


Joined: 06 Jan 2011
Posts: 572
Location: Scotland

PostPosted: Thu Jul 03, 2014 2:53 pm    Post subject: Systemd help needed please. Reply with quote

Hey team.

Trying to find out how I create a systemd unit file for the following. (which is taken from /etc/init.d/nrpe)
Code:
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nrpe/files/nrpe.init,v 1.4 2014/04/19 17:18:03 robbat2 Exp $

: ${CFGFILE:=/etc/nagios/nrpe.cfg}

get_config() {
    [ -f ${CFGFILE} ] || return 1

    sed -n -e 's:^[ \t]*'$1'=\([^#]\+\).*:\1:p' \
   ${CFGFILE}
}

extra_started_commands=""

command=/usr/libexec/${SVCNAME}
command_args="-c ${CFGFILE} --daemon"
pidfile=$(get_config pid_file)

depend() {
    config ${CFGFILE}
}


start()
{
    mkdir -p $(dirname $pidfile)
    local _background=
    ebegin "Starting ${name:-$RC_SVCNAME}"
    eval start-stop-daemon --start \
        --exec $command \
        ${procname:+--name} $procname \
        ${pidfile:+--pidfile} $pidfile \
        $_background $start_stop_daemon_args \
        -- $command_args
    if eend $? "Failed to start $RC_SVCNAME"; then
        service_set_value "command" "${command}"
        [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
        [ -n "${procname}" ] && service_set_value "procname" "${procname}"
        return 0
    fi 
    return 1
}


Nagios and Nrpe have not been ported for use on systemd yet, and the init scripts are now redundant.

Any systemd wizards out there?
_________________
Whatever you do, do it properly!
Back to top
View user's profile Send private message
mackal
Tux's lil' helper
Tux's lil' helper


Joined: 04 Aug 2011
Posts: 87

PostPosted: Thu Jul 03, 2014 4:45 pm    Post subject: Reply with quote

http://0pointer.de/blog/projects/systemd-for-admins-3.html

Edit: there are also some here https://github.com/fukawi2/aur-packages/tree/master/nagios-nrpe
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum