PIKT Startup Script

Here is a suggested PIKT startup script. 

#!/bin/bash

### BEGIN INIT INFO
# Provides: pikt
# Required-Start: $network $portmap
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: Service(s) needed with PIKT
### END INIT INFO

dokill() {
        pid=`ps auwx | egrep "$1$" | awk '{print $2}'`
        if [ -n "$pid" ]; then
                kill $pid
        fi
}

cleanup() {
        cd /pikt/etc
        rm alerts *.lock 2>/dev/null
        cd /pikt/var/histories
        rm *.tmp 2>/dev/null
}

start() {
        echo "Starting PIKT"
        cleanup
        /pikt/bin/piktc_svc
        /pikt/bin/piktd
}

stop() {
        echo "Stopping PIKT"
        dokill /pikt/bin/piktd
        dokill /pikt/bin/piktc_svc
        cleanup
}

restart() {
        stop
        start
}

if [ $1 = "stop" ]; then
        stop
elif [ $1 = "start" ]; then
        start
elif [ $1 = "restart" ]; then
        stop
        start
fi

You might add this to your /etc/init.d directory (or some other startup directory, depending on your OS or Linux distribution), then register this (for example, for Gentoo Linux and other similar distros) in your /etc/runlevels/default directory with the command

# ln -s /etc/init.d/pikt /etc/runlevels/default
You can also use this script interactively to start Linux (for example, just after a new PIKT installation)

# /etc/init.d/pikt start
Starting PIKT

to restart PIKT

# /etc/init.d/pikt restart
Stopping PIKT
Starting PIKT

and to stop PIKT

# /etc/init.d/pikt stop
Stopping PIKT

The version shown is known to work with SuSE and Gentoo Linux.  Adjust to fit your OS accordingly.

For more examples, see Samples.

 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
log scan
script macro