kstart/k5start start-up script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting kstart/k5start start-up script
# 1  
Old 10-18-2011
Java kstart/k5start start-up script

I've recently been working with k5start on a RHEL 5 client and noticed that it lacked a start-up script. As usual, it seems such a waste for me to write one and not share it with everyone else, so for those who may also need this at some point in the future:
Code:
#!/bin/bash
#
# k5start:      Keeps Kerberos 5 ticket-granting ticket active indefinitely
# Author:       Mark R. Bannister <cambridge@users.sourceforge.net>
#
# chkconfig: 345 19 74
# description:  Keeps Kerberos 5 ticket-granting ticket active indefinitely
#
# processname: /usr/bin/k5start
# config: /etc/krb5.conf
# pidfile: /var/run/k5start.pid

# Sanity checks.
[ -f /etc/krb5.conf ] || exit 0
[ -x /usr/bin/k5start ] || exit 0

# Source function library.
. /etc/init.d/functions

K5START_KEYTAB=/etc/krb5.keytab
K5START_MINUTES=30
K5START_OPTIONS=

# Source an auxiliary options file if we have one
# This can override K5START_KEYTAB, K5START_MINUTES and K5START_OPTIONS
# It can also set DAEMON_COREFILE_LIMIT and NICELEVEL
[ -r /etc/sysconfig/k5start ] && . /etc/sysconfig/k5start

RETVAL=0

start() {
    echo -n $"Starting k5start: "
    daemon /usr/bin/k5start -f $K5START_KEYTAB -bLK$K5START_MINUTES \
                        -p /var/run/k5start.pid $K5START_OPTIONS -U
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/k5start
    return $RETVAL
}

stop() {
    echo -n $"Stopping k5start: "
    killproc -p /var/run/k5start.pid k5start
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/k5start
    echo
    return $RETVAL
}

restart() {
    stop
    start
}

# See how we were called.
case "$1" in
    start)
        start
        RETVAL=$?
        ;;
    stop)
        stop
        RETVAL=$?
        ;;
    status)
        status -p /var/run/k5start.pid k5start
        RETVAL=$?
        ;;
    restart)
        restart
        RETVAL=$?
        ;;
    try-restart | condrestart)
        [ -e /var/lock/subsys/k5start ] && restart
        RETVAL=$?
        ;;
    force-reload | reload)
        echo -n $"Refreshing k5start ticket cache: "
        killproc /usr/bin/k5start -ALRM
        RETVAL=$?
        echo
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
        RETVAL=1
        ;;
esac
exit $RETVAL

If you find that the k5start process is dying, you'll either need a root cron job to do /etc/init.d/k5start restart at intervals, or you can follow the advice in this posting and use respawn in /etc/inittab.

Best regards,
Mark.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Systemd cant start my script

Hi, systemd cant start my script, but it work, at command prompt. Code and execute at command prompt #cat collector.sh #!/bin/bash case $1 in start) /home/postgres/scripts/pgwatch2/pgwatch2.sh /home/postgres/scripts/pgwatch2/pgwatch2_UI.sh ;; ... (7 Replies)
Discussion started by: kvaikla
7 Replies

2. Shell Programming and Scripting

Script to start process

Hi I want to create a script to be able to check if a process is running and act on it. Essentially I want to: Check acc process status /opt/ca/APMCommandCenterController./apmccctrl.sh status If process found not to be running Execute start command... (6 Replies)
Discussion started by: simpsa27
6 Replies

3. Shell Programming and Scripting

Start up init d script

Hi All, I'm trying to build a start up script, wud be gr8 if any one can explain what the below field means and how can i check it for my script. DAEMON_PATH="/home/wes/Development/projects/myapp" DAEMON=myapp DAEMONOPTS="-my opts" NAME=myapp DESC="My daemon description"... (4 Replies)
Discussion started by: Karthick N
4 Replies

4. Red Hat

kstart question

To all pro how I assign telnet server to 'Destop 1' using kstart? thkx in adv jiajin (0 Replies)
Discussion started by: lijiajin
0 Replies

5. Shell Programming and Scripting

Start program in background (or start crontab ahead of time)

Hey! I'm working on a script that will add a user, create some configfiles, and add a crontab for the user. The crontab looks like the following: @reboot /home/user/program config.conf & I would like for this process to start at the end of my script under the corresponding username by... (0 Replies)
Discussion started by: noratx
0 Replies

6. UNIX Desktop Questions & Answers

Where is xwindow start script

I am using a Mandrake spinoff (PCLinux) and would like to have a yakuake terminal started when I launch xwin. Where is the start up script? Thanks JZ (2 Replies)
Discussion started by: jwzumwalt
2 Replies

7. Shell Programming and Scripting

start a script from another tty

Hello all, im quite new to linux and was wonder if there was a way to start a script e.g. ./script1 on another tty for example im on /dev/pts/0 and i want to start a script called ./script1 on /dev/pts/1 but without actually typing directly into pts1 only into pts0 :) how would i go about... (1 Reply)
Discussion started by: moka
1 Replies

8. Shell Programming and Scripting

Start up script

Hello, I have a script that starts a type of web server that I need to get to start up at startup, I would like to keep the current script in its directory and not stick it in the rc directorys. So really I want a shell script that will execute the web server script at startup. I dont really... (1 Reply)
Discussion started by: Mr Pink
1 Replies

9. UNIX for Dummies Questions & Answers

Start/Stop Script

I'm a newbie to the Unix world Help! I have to maintain a host of Sybase database servers sitting on Unix Sun Solaris 8...I've been tasked with finding/creating a way to auto start/stop Unix via unix commands, specifically when the Unix servers need to be restarted we want Sybase to start... (2 Replies)
Discussion started by: jjv1
2 Replies

10. UNIX for Dummies Questions & Answers

Start Up Script

guys/gals...does anyone have a startup shell script for oracle/sybase...meaning at shutdown the databases stop themselves and at start up they start automatically...thanks much... (3 Replies)
Discussion started by: suntan
3 Replies
Login or Register to Ask a Question