LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-21-2006, 03:11 PM   #1
evilmonkey
Member
 
Registered: Jun 2003
Location: Toronto, Canada
Distribution: Ubuntu 10.04 LTS; CentOS 5.5
Posts: 199

Rep: Reputation: 30
Run Shell COmmand on start-up


For some reason, ifconfig lo is not set to 127.0.0.1 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 127.0.0.1 Not too hard. Where can I put it? I'm running kubuntu breezy. Thanks.
 
Old 05-21-2006, 03:25 PM   #2
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
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
 
Old 05-21-2006, 05:12 PM   #3
evilmonkey
Member
 
Registered: Jun 2003
Location: Toronto, Canada
Distribution: Ubuntu 10.04 LTS; CentOS 5.5
Posts: 199

Original Poster
Rep: Reputation: 30
I put that line into /etc/rc5.d/S15cupsys, so now that file looks like this:

Code:
#! /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 <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	@(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
#
# This file was automatically customized by dh-make on Sun,  3 Oct 1999 20:58:02 -0500

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/cupsd
NAME=cupsd
DESC="Common Unix Printing System"

ifconfig lo 127.0.0.1 #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
fi

case "$1" in
  start)
	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/cupsd.pid --exec $DAEMON -- -F
	log_end_msg $?
	;;
  stop)
	log_begin_msg "Stopping $DESC: $NAME"
	start-stop-daemon --stop --quiet --retry TERM/10 --oknodo --exec $DAEMON
	rm -f /var/run/cups/cupsd.pid
	log_end_msg $?
	;;
  restart|force-reload)
	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/cupsd.pid --exec $DAEMON -- -F
	fi
	log_end_msg $?
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
Would that do it?
 
Old 05-21-2006, 05:24 PM   #4
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
Reboot and try?

providing you are booting into run level 5 it should
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vim: run shell command without acknowledgement jrdioko Linux - Software 2 02-25-2006 08:52 PM
run shell command with php varunbihani Programming 5 12-06-2005 12:25 AM
run shell command inside of c code? khucinx Programming 2 05-17-2004 10:04 AM
how to run shell command in java? u4u Linux - General 3 03-02-2004 09:08 AM
How to run a shell command containing awk, and grep within a C program Linh Programming 3 06-05-2003 07:05 PM


All times are GMT -5. The time now is 01:24 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration