Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
targetcli-fb init script missing?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
darrek
n00b
n00b


Joined: 10 Mar 2005
Posts: 6
Location: Oregon

PostPosted: Mon Sep 03, 2018 3:00 pm    Post subject: targetcli-fb init script missing? Reply with quote

Is it me, or does targetcli-fb not have an init script (for Gentoo) to restore configuration after reboot?

I ended up writing my own initscript based off another distribution since I couldn't find one.

May not be pretty, but it works. Here it is if anyone else wants it

/etc/inid.d/targetcli-fb
Code:
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

description="ISCSI Target"
command="/usr/bin/targetcli"
pidfile="/var/lock/targetcli-fb"

depend() {
        need net
        after modules-load
}

start() {
        ebegin "Restoring ISCSI Target Configuration"
        if ${command} restoreconfig >/dev/null 2>&1 ; then
                touch /var/lock/targetcli
        else
                eerror "Error restoring ISCSI Configuration"
                return 1
        fi
        eend $?
}

stop() {
        ebegin "Clearing ISCSI Target Configuration"
        if ${command} clearconfig confirm=True >/dev/null 2>&1 ; then
                rm -f /var/log/targetcli > /dev/null 2>&1
        else
                eerror "Error Clearing ISCSI configuration"
                return 1
        fi
        eend $?
}


restart() {
        ebegin "Reloading persisted ISCSI Target Configuration"
        stop
        start
        eend $?
}


-Darrek
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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