Startup script for Typo

Posted by Paul Verreth Mon, 26 Mar 2007 06:30:00 GMT

This is an init script you can use so that typo will be started after an system reboot. Using chkconfig, it wil be activated in the runlevel system (/etc/rc[0-6].d)

Also see: Installing typo with the installer

#!/bin/bash
#
#       /etc/rc.d/init.d/typo_sos
#
# Start typo blogging engine
#
# chkconfig: - 65 35
# description: Typo blogging engine
# processname: typo
# Source function library.
. /etc/init.d/functions

TYPO=/usr/bin/typo
TYPODIR=/var/www/your-website-directory/blog

test -x $TYPO || exit 0

RETVAL=0
prog="Typo blogging engine" 

start() {
        echo -n $"Starting $prog: " 
        cd $TYPODIR
        $TYPO start $TYPODIR
        RETVAL=$?
        echo
}

stop() {
        echo -n $"Stopping $prog: " 
        cd $TYPODIR
        $TYPO stop $TYPODIR
        RETVAL=$?
        echo
}

#
#       See how we were called.
#
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}" 
        exit 1
esac

exit $RETVAL

chkconfig

On fedora you can use chkconfig to activate the startup script. Please also read the chkconfig man page.

To be manageable by chkconfig, the script needs a special section, an example follows:
# chkconfig: - 65 35
# description: Typo blogging engine
# processname: typo
Active? And in wich runlevels?
chkconfig --list typo_sos
service typo_sos supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add typo_sos')
So it is added, but not yet activated:
chkconfig --add typo_sos
chkconfig --list typo_sos
typo_sos        0:off   1:off   2:off   3:off   4:off   5:off   6:off

And, to activate:

chkconfig typo_sos on

chkconfig --list typo_sos
typo_sos        0:off   1:off   2:on    3:on    4:on    5:on    6:off

Posted in  | Tags , ,

Comments are disabled