Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

Keepalived initialization file

sudo nano /etc/init.d/keepalived
Comment

Keepalived initialization file content

#! /bin/sh
#
# keepalived   LVS cluster monitor daemon.
#
#              Written by Andres Salomon <dilinger@voxel.net>
#
### BEGIN INIT INFO
# Provides:          keepalived
# Required-Start:    $syslog $network $remote_fs
# Required-Stop:     $syslog $network $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts keepalived
# Description:       Starts keepalived lvs loadbalancer
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
DAEMON=/usr/local/sbin/keepalived
NAME=keepalived
DESC=keepalived
TMPFILES="/tmp/.vrrp /tmp/.healthcheckers"

#includes lsb functions 
. /lib/lsb/init-functions

test -f $CONFIG || exit 0 
test -f $DAEMON || exit 0


# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

case "$1" in
  start)
        log_daemon_msg "Starting $DESC" "$NAME"
    for file in $TMPFILES
    do 
            test -e $file && test ! -L $file && rm $file
    done
    if start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid 
               --exec $DAEMON -- $DAEMON_ARGS; then
        log_end_msg 0
    else
        log_end_msg 1
    fi
       ;;
  stop)
    log_daemon_msg "Stopping $DESC" "$NAME"
    if start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid 
            --exec $DAEMON; then
        log_end_msg 0
    else
        log_end_msg 1
    fi
       ;;
  reload|force-reload)
    log_action_begin_msg "Reloading $DESC configuration..."
        if start-stop-daemon --stop --quiet --signal 1 --pidfile 
               /var/run/$NAME.pid --exec $DAEMON; then
           log_end_msg 0
    else
        log_action_end_msg 1
    fi
       ;;
  restart)
    log_action_begin_msg "Restarting $DESC" "$NAME"

        start-stop-daemon --stop --quiet --pidfile 
        /var/run/$NAME.pid --exec $DAEMON || true 
       sleep 1
       if start-stop-daemon --start --quiet --pidfile 
               /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_ARGS; then
           log_end_msg 0
    else
        log_end_msg 1
    fi
       ;;
  *)
       echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2
       exit 1
       ;;
esac

exit 0
Comment

PREVIOUS NEXT
Code Example
Shell :: how to chop large sequences in linux 
Shell :: how to install deface makers for ubuntu 
Shell :: bash read length of fasta file seqeunces 
Shell :: download sklearn arch 
Shell :: awk match last occurrence 
Shell :: how to install rman in oracle 12c 
Shell :: bbedit close without saving 
Shell :: silent installation with powershell 
Shell :: login to linux server from windows putty 
Shell :: cscp from remote server to windows subsystem 
Shell :: untar multiple archives into thier own folders linux command 
Shell :: execute command on every recursive directory 
Shell :: get info about an audio file ffmpeg 
Shell :: install virtualenv ubuntu 18.04 stackoverflow 
Shell :: digital assistant 
Shell :: admin passwort eingeben wenn powershell script ausgeführt wird 
Shell :: use xargs multiple times 
Shell :: change nmp proxy password 
Shell :: how to send files viascp to virtual machine 
Shell :: E: Unable to locate package ros-noetic-depthimage-to-laserscan 
Shell :: install modules mu 
Shell :: git repo has too many changes vscode 
Shell :: linux forensic deleted files 
Shell :: Clone gigamono repository 
Shell :: command line audio splitting 
Shell :: How can I become the owner of a file/folder that root owns? 
Shell :: view shell variables 
Shell :: use -i 
Shell :: iterm full screen cmd 
Shell :: how to install node modules python 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =