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