-   Linux - Software (
-   -   Run Shell COmmand on start-up (

evilmonkey 05-21-2006 04:11 PM

Run Shell COmmand on start-up
For some reason, ifconfig lo is not set to on startup. I need this in order to run CUPS. How can I avoid going to the konsole each time I restart my computer? I need to run the following command (as root): ifconfig lo Not too hard. :) Where can I put it? I'm running kubuntu breezy. Thanks.

ethics 05-21-2006 04:25 PM

Kubuntu? so you're using KDE? well if you want to start it when the DE starts then you can put scripts/symlinks in ~/.kde/Autostart.

But if you are wanting to up something like that, before the CUPS deamon then you will have to put it into a shell script in /etc/rc.d or similar

evilmonkey 05-21-2006 06:12 PM

I put that line into /etc/rc5.d/S15cupsys, so now that file looks like this:


#! /bin/sh
# cupsys        example file to build /etc/init.d/ scripts.
#                This file should be used to construct scripts for /etc/init.d.
#                Written by Miquel van Smoorenburg <>.
#                Modified for Debian GNU/Linux
#                by Ian Murdock <>.
# Version:        @(#)skeleton  1.8  03-Mar-1998
# This file was automatically customized by dh-make on Sun,  3 Oct 1999 20:58:02 -0500

DESC="Common Unix Printing System"

ifconfig lo #bring up the loopback interface so CUPS doesn't CRASH!

test -f $DAEMON || exit 0

set -e

. /lib/lsb/init-functions

# Get the timezone set.
if [ -e /etc/timezone ]; then
    TZ=`cat /etc/timezone`
    export TZ

case "$1" in
        log_begin_msg "Starting $DESC: $NAME"
        chown root:lpadmin /usr/share/cups/model 2>/dev/null || true
        chmod 3775 /usr/share/cups/model 2>/dev/null || true
        start-stop-daemon --start --quiet --background -m --pidfile /var/run/cups/ --exec $DAEMON -- -F
        log_end_msg $?
        log_begin_msg "Stopping $DESC: $NAME"
        start-stop-daemon --stop --quiet --retry TERM/10 --oknodo --exec $DAEMON
        rm -f /var/run/cups/
        log_end_msg $?
        log_begin_msg "Restarting $DESC: $NAME"
        if start-stop-daemon --stop --quiet --retry TERM/10 --oknodo --exec $DAEMON; then
                start-stop-daemon --start --quiet --background -m --pidfile /var/run/cups/ --exec $DAEMON -- -F
        log_end_msg $?
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1

exit 0

Would that do it?

ethics 05-21-2006 06:24 PM

Reboot and try? :)

providing you are booting into run level 5 it should

All times are GMT -5. The time now is 08:48 AM.