RHEL4 init.d LCDd

From MythTV Official Wiki
Revision as of 18:09, 18 May 2006 by Gregturn (talk | contribs)

Jump to: navigation, search

Script

#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops the LCDd daemon \
#              used to provide LCDd display services.
#
# config:  /etc/LCDd.conf


# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# Avoid using root's TMPDIR
unset TMPDIR

# Source networking configuration.
. /etc/sysconfig/network

if [ -f /etc/sysconfig/LCDd ]; then
   . /etc/sysconfig/LCDd
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that LCDd.conf exists.
[ -f /etc/LCDd.conf ] || exit 0

RETVAL=0


start() {
        KIND="LCDd"
        echo -n $"Starting $KIND services: "
        daemon LCDd -c /etc/LCDd.conf
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/LCDd || \
           RETVAL=1
        return $RETVAL
}

stop() {
        KIND="LCDd"
        echo -n $"Shutting down $KIND services: "
        killproc LCDd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/LCDd
        echo ""
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading smb.conf file: "
        killproc LCDd -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

rhstatus() {
        status LCDd
}


# Allow status as non-root.
if [ "$1" = status ]; then
       rhstatus
       exit $?
fi

# Check that we can write to it... so non-root users stop here
[ -w /etc/LCDd.conf ] || exit 0



case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  condrestart)
        [ -f /var/lock/subsys/LCDd ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
        exit 1
esac

exit $?

You'll need to copy that file to /etc/init.d/LCDd then from within the /etc/init.d directory run: chmod 755 LCDd

After you've done that you can verify that its working buy running: /etc/init.d/LCDd restart

You should see it fail to stop (assuming its not running already) and then succeed in starting.

If all that goes as planned the last step is to set it up to start at boot. To do this we use the trusty chkconfig command as follows:

  1. chkconfig --add LCDd
  2. chkconfig LCDd on

Thats it.

You can double check that its there and ready to run if you'd like by running:

  1. chkconfig --list | less

And scrolling through all the startup scripts.

That really should be it. Once the VFD is working all you need to do is go into setup>setup>appearance and configure Myth to use the LCD display. Again Issac, I bow my head. :)

Hope this helps.