LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 07-13-2005, 11:26 PM   #1
snip128
Member
 
Registered: Jan 2004
Location: Delaware
Distribution: gentoo
Posts: 96

Rep: Reputation: 15
how do i add daemons to the startup?


lets say i wanted to add vncserver to be run during startup, how would i go about doing this? i'm runnning debian (duh) with a 2.4 kernel
 
Old 07-14-2005, 04:02 AM   #2
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Following command will help you:

Code:
cd /etc/init.d/
update-rc.d  vncserver defaults
 
Old 07-14-2005, 07:08 AM   #3
snip128
Member
 
Registered: Jan 2004
Location: Delaware
Distribution: gentoo
Posts: 96

Original Poster
Rep: Reputation: 15
umm...when i do that, it says

update-rc.d: /etc/init.d/vncserver: file does not exist

so, i tried symlinking it and still doesnt work...do i have to copy the file to /etc/init.d? also, how would i go about adding something like ifconfig? i got a few commands i need to run at startup
 
Old 07-14-2005, 01:20 PM   #4
slacky
Member
 
Registered: Feb 2004
Location: USA
Distribution: Debian
Posts: 174

Rep: Reputation: 16
You need to write a startup shell script, put it in /etc/init.d & make it executable first.

I stripped one of my scripts to kind of a template if you need it. Pretty much put the commands you want to run at startup in the 'start)' section - if its simple enough you can leave the stop) and status) empty.

Hope that helps,
Josh

Code:
#!/bin/bash
# josh 11-23-2004
# shell script to ...

#set the full path to the programs we need to use
NTOP=/usr/sbin/ntop
KILLALL=/usr/bin/killall

case "$1" in
	start)
		#run ntop for web monitoring
		echo "Starting ntop..."
		$NTOP -u ntop -i br0 -d -w0 -W4430		
		;;
	stop)
		#kill ntop
		echo "Stopping ntop..."
		$KILLALL ntop		
		;;
	restart)
		$0 stop
		$0 start
		;;
	status)
		;;
	*)
		echo "Usage: $0 {start|stop|restart|status}"
		;;
esac
 
Old 07-14-2005, 09:58 PM   #5
snip128
Member
 
Registered: Jan 2004
Location: Delaware
Distribution: gentoo
Posts: 96

Original Poster
Rep: Reputation: 15
thx, that helped a lot...just one thing left...

how do i make it read the command with the options? like...when i do...

Code:
ifconfig eth0 up
it'll say

Code:
./ipscript: line 16: eth0: command not found
also, the modprobe isn't working...heres my script

Code:
#!/bin/bash
# josh 11-23-2004
# shell script to ...

#set the full path to the programs we need to use
IFCONFIG=/sbin/ifconfig
DHCPCD=/sbin/dhcpcd
KILLALL=/usr/bin/killall
MODPROBE=/sbin/modprobe
IPTABLES=/sbin/iptables

case "$1" in
        start)
                #start internet sharing
                echo "Configuring Network Devices"
                $ifconfig eth0 up
                $ifconfig eth0 192.168.1.1
                $dhcpcd eth1
                $modprobe iptable_nat
                $iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
                ;;
        stop)
                #kill ips
                echo "Stopping internet scripts..."
                $ifconfig eth0 down
                $ifconfig eth1 down
                ;;
        restart)
                $0 stop
                $0 start
                ;;
        status)
                ;;
        *)
                echo "Usage: $0 {start|stop|restart|status}"
                ;;
esac
ERRORS!

Code:
debian:/etc/init.d# ./ipscript start
Configuring Network Devices
./ipscript: line 16: eth0: command not found
./ipscript: line 17: eth0: command not found
./ipscript: line 18: eth1: command not found
./ipscript: line 19: iptable_nat: command not found
./ipscript: line 20: -t: command not found
thx..

Last edited by snip128; 07-14-2005 at 09:59 PM.
 
Old 07-15-2005, 06:29 AM   #6
slacky
Member
 
Registered: Feb 2004
Location: USA
Distribution: Debian
Posts: 174

Rep: Reputation: 16
Looks like you need to replace $ifconfig with $IFCONFIG, etc. in your script - bash variables are case sensitive.
 
Old 07-15-2005, 09:33 AM   #7
snip128
Member
 
Registered: Jan 2004
Location: Delaware
Distribution: gentoo
Posts: 96

Original Poster
Rep: Reputation: 15
works great now, ty ty
 
  


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
startup daemons? c_olin3404 Slackware 6 05-16-2005 03:21 PM
Daemons upon Fluxbox Startup Chu Linux - Newbie 3 03-17-2004 03:28 PM
loading services/daemons at startup sirpimpsalot Linux - Newbie 3 03-05-2004 06:45 PM
Preventing auto startup of various daemons ssmaitra Linux - Software 2 03-04-2004 11:56 PM
How do add daemons/servers to auto-startup list? bjc Linux - Newbie 2 10-23-2000 04:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 03:21 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration