Sponsored Content
Top Forums Shell Programming and Scripting kstart/k5start start-up script Post 302565498 by cambridge on Tuesday 18th of October 2011 05:00:55 AM
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
SERVICE(8)                                                    System Manager's Manual                                                   SERVICE(8)

NAME
service - run a System V init script SYNOPSIS
service SCRIPT COMMAND [OPTIONS] service --status-all service --help | -h | --version DESCRIPTION
service runs a System V init script or systemd unit in as predictable an environment as possible, removing most environment variables and with the current working directory set to /. The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT, or the name of a systemd unit. The existence of a systemd unit of the same name as a script in /etc/init.d will cause the unit to take precedence over the init.d script. The supported val- ues of COMMAND depend on the invoked script. service passes COMMAND and OPTIONS to the init script unmodified. For systemd units, start, stop, status, and reload are passed through to their systemctl/initctl equivalents. All scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start command. service --status-all runs all init scripts, in alphabetical order, with the status command. The status is [ + ] for running services, [ - ] for stopped services and [ ? ] for services without a status command. This option only calls status for sysvinit jobs. EXIT CODES
service calls the init script and returns the status returned by it. FILES
/etc/init.d The directory containing System V init scripts. /{lib,run,etc}/systemd/system The directories containing systemd units. ENVIRONMENT
LANG, LANGUAGE, LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEA- SUREMENT, LC_IDENTIFICATION, LC_ALL, TERM, PATH The only environment variables passed to the init scripts. SEE ALSO
/etc/init.d/skeleton update-rc.d(8) init(8) invoke-rc.d(8) systemctl(1) AUTHOR
Miloslav Trmac <mitr@redhat.com>, Petter Reinholdtsen <pere@hungry.com> Licence: GNU Public Licence v2 (GPLv2) COPYRIGHT
2006 Red Hat, Inc., Petter Reinholdtsen <pere@hungry.com> Jan 206 SERVICE(8)
All times are GMT -4. The time now is 01:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy