LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   lirc init script... (http://www.linuxquestions.org/questions/slackware-14/lirc-init-script-96235/)

El_Angelo 09-24-2003 07:02 AM

lirc init script...
 
I have installed lirc on my slackbox and the remotecontrol works pretty fine (not pretty.. just perfect :D )...

but (there is always a but....) :p

I have to start lircd myself at bootup time (it is a daemon) by typing in a console "lircd" this works pretty fine but as I am planning to get rid of the keyboard it is not an option to keep doing it like this... (I don't have a screen or mouse either... don't mind understanding it... it has to do with making a mp3box)
Long time ago I was trying the same with debian and there you can install lirc with a deb package and it adds automatically the initscript so it starts the lircd daemon the moment you start the computer...
but (again)
I didn't like debian (sorry debian users) and switched to slack (which I like quite a lot) but now as is the case with slack it doesn't do these things so lircd automatically starts up by itself... That's allright with me but I want it to start-up and that's where I'm stuck...
in the /usr/share/lirc/contrib directory you can find a few init-scripts for certain distributions (being : suse, redhat, debian and so on...) but guess what : NO SLACKWARE... althought there is a script without a name (actually it is called lircs). I posted it here below...

Now the question... Would it be enought to add this script to the /etc/rc.d directory and make it executable to make sure that the lirc-daemon starts up??? Or do I still have to adjust another file? Or is there a more simple way??? (I already tried to adjust rc.inet1, but this doesn't work : I added
#start up lircd daemon
if [ -x /usr/share/sbin/lircd ] then
echo "starting the lircd daemon"
. /usr/share/sbin/lircd
fi
but this doesn't seem to work... (not even a single bit :( )


lircs-file :


#!/bin/bash
#
# ---------------------------------------------------------------------
#
# LIRC starter (called 'lircs' for simplicity)
#
# A simple shell script to make the configuration of LIRC more comfortable.
#
# It may be necessary to change the script if ...
# - you have a non-standard installation or
# - you use more or other client applications (see below) or
# - the init scripts are located elsewhere on your Linux system (see below).
#
# ---------------------------------------------------------------------
#
# author: Michael Kammerer <M.Kammerer@gmx.de>
#
# PLEASE send me your comments, ideas, bug reports, ... via E-Mail.
#
# ---------------------------------------------------------------------

# location of the LIRC config file
# change this if your LIRC config file is located elsewhere
CONFIG_FILE=${HOME}/.lircrc

# any editor to edit LIRC config file
FILE_EDITOR=vim



# function declarations

start_clients () {
if [ -s ${CONFIG_FILE} ]; then
echo -n Starting LIRC clients ...

# add more clients HERE or change the ones I put here as a start
irxevent &
irexec --daemon

echo " done"
else
echo "LIRC config file not found in ${CONFIG_FILE}"
exit 1
fi
}

restart_lircd () {
if [ "${USER}" = "root" ]; then
# change this if your Linux system keeps the init scripts elsewhere
/sbin/init.d/lircd restart
else
echo "`basename ${0}`: you must be 'root' to restart the LIRC daemon (lircd)."
exit 1
fi
}

stop_lircd () {
if [ "${USER}" = "root" ]; then
# change this if your Linux system keeps the init scripts elsewhere
/sbin/init.d/lircd stop
else
echo "`basename ${0}`: you must be 'root' to stop the LIRC daemon (lircd)."
exit 1
fi
}

edit_config_file () {
${FILE_EDITOR} ${CONFIG_FILE}
}

print_info () {
echo "LIRC starter version 0.2, 09/2000 "
echo "Written by Michael Kammerer <M.Kammerer@gmx.de>."
echo "Visit 'www.crosswinds.net/~michaelkammerer/lircs' for updates."
}

print_help () {
echo "LIRC starter usage: lirc [option]"
echo "'option' can be:"
echo "as any user:"
echo "-h | --help print this short help text"
echo "-c | --clients start LIRC clients (necessary if lircd was restarted)"
echo "-e | --edit edit LIRC config file '${CONFIG_FILE}'"
echo "-v | --version print script version and other info"
echo "only as 'root':"
echo "-r | --restart restart LIRC daemon (lircd) "
echo "-s | --stop stop LIRC daemon"
}


# processing of command line arguments

case $1 in
-r)
restart_lircd
;;
--restart)
restart_lircd
;;
-s)
stop_lircd
;;
--stop)
restart_lircd
;;
-c)
start_clients
;;
--clients)
start_clients
;;
-h)
print_help
;;
--help)
print_help
;;
-e)
edit_config_file
;;
--edit)
edit_config_file
;;
-v)
print_info
;;
--version)
print_info
;;
*)
print_help
;;
esac

mrpdaemon 09-24-2003 07:18 AM

really simple to do.

add "lircd" in the file "/etc/rc.d/rc.local"

and lircd will be run at next reboot.

El_Angelo 09-24-2003 07:27 AM

I'll try that... (do you use lirc?)

mrpdaemon 09-24-2003 11:05 AM

Quote:

Originally posted by El_Angelo
I'll try that... (do you use lirc?)
no I do not :)

but rc.local is one of the many ways to add something to the boot sequence of Slack 9.

El_Angelo 09-25-2003 02:20 AM

it worked :D
but I fucked up the kernel yesterday so I can start all over.... :'(


All times are GMT -5. The time now is 05:37 PM.