init.d script for smuxi-server

Quick&Dirty:

#!/bin/bash

USER=michael
GROUP=michael
PIDFILE=/var/run/smuxi.pid

case "${1:-''}" in
  'start')
           start-stop-daemon -S -c $USER -g $GROUP --make-pidfile --pidfile $PIDFILE --background --startas /usr/bin/smuxi-server -v
        ;;
  'stop')
           start-stop-daemon -K --pidfile $PIDFILE -v
        ;;
  *)
        echo "Usage: $SELF start|stop"
        exit 1
        ;;
esac

1 thought on “init.d script for smuxi-server

  1. Ebenfalls Quick&Dirty 😉

    Hier mein Initskript für Gentoo Linux:

    #!/sbin/runscript

    USER=smuxi
    COMMAND=smuxi-server
    PIDFILE=/var/run/smuxi-server.pid

    depend() {
    need net
    after sshd
    }

    start() {
    ebegin “Starting smuxi-server”
    start-stop-daemon -b -m -u $USER –start –exec $COMMAND
    –pidfile $PIDFILE
    eend $?
    }

    stop() {
    start-stop-daemon -u $USER –stop –pidfile $PIDFILE
    ebegin “Stopping smuxi-server”
    if [ “`ps -u $USER | grep sshd`” ];then
    pkill -u $USER sshd
    fi
    eend $?
    }

    Ich verbinde mich zum Smuxi-Server via Ssh, darum pürft das Initscript beim beenden, ob noch Ssh-Verbindungen des Users offen sind und killt diese bei Bedarf.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s