Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-08-2005, 06:51 AM   #1
Registered: Aug 2003
Location: Netherlands
Distribution: SuSE 10 Pro
Posts: 43

Rep: Reputation: 15
Howto start script at boot ?


I have a SuSE 9.3 Prof. install and have my own firewall script, therefore i have disabled SuSEFirewall2.
What i would like to do at bootime is check if my network, dhcp and Samba is up and running and then start my firewall script.
I have my script in /etc/init.d and added my firewall script with Yast2 (start at runlevel 3 wich is my default runlevel), but my firewall script is always executed before my network, dhcp and Samba is up and therefore i always need to start my firewall script manually after i have logged in.
Can someone help me out please?

Old 11-08-2005, 07:22 AM   #2
Registered: Jul 2005
Location: Leeds, UK
Distribution: SuSE 10.0
Posts: 108

Rep: Reputation: 15
Is there a boot.local file in init.d? i think (though may be wrong) that the contents of this get executed at the required time.
Old 11-08-2005, 10:33 AM   #3
Registered: Aug 2004
Location: Wales
Distribution: Mint, Mageia, OpenSUSE, Kubuntu
Posts: 95

Rep: Reputation: 25
Put a symbolic link from /etc/rc3.d (for runlevel 3 - if not change the 3 to 1, 2, 4 or 5) to your script in /etc/init.d. The name of the link should begin with S (upper case) followed by 2 numbers. The scripts are executed in the order of the names of the links, so S50xyz will run before S51abc.
I am not familiar with SuSE, so Yast2 may already have put a link there, in which case you probably just need to rename it.
Old 11-15-2005, 01:42 PM   #4
Registered: Aug 2003
Location: Netherlands
Distribution: SuSE 10 Pro
Posts: 43

Original Poster
Rep: Reputation: 15
Hi all,

Sorry for the late response but i was ill :-(

I tried your suggestions but with no luck, however i have found a nice solution that works for me.
After some searching on internet i found some more info and have written a little script to
check if network is up and then start my firewall.

Here's my script :

#! /bin/sh
# Provides:          Firewall
# Required-Start:    $network $syslog
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Custom IPTables Firewall Rules 
# Description:       Starting Firewall
# continued on second line by '#<TAB>'
# should contain enough info for the runlevel editor
# to give admin some idea what this service does and
# what it's needed for ...
# (The Short-Description should already be a good hint.)


test -x $DAEMON || exit 0

. /etc/rc.status

case "$1" in
    echo -n "Starting Firewall: "
    start-stop-daemon --start --pidfile /var/run/ --exec $DAEMON
    rc_status -v
    echo -n "Shutting down Firewall:"
    `iptables --flush`
    rc_status -v

    echo -n "Restarting Firewall: "
    echo -n "...shutting down Firewall..."
    `iptables --flush`
    rc_status -v
    echo -n "Starting Firewall: "
    start-stop-daemon --start --pidfile /var/run/ --exec $DAEMON
    rc_status -v

    echo "Usage: $0 {start|stop|restart}"
    exit 1
exit 0
The pidfile option does not seem to work, but i believe that's because its only a set of firewall rules
and not really a executable.



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
Howto setup VSFTPD start up at boot longnam Slackware 1 08-13-2005 12:14 PM
startgnome command/howto get xserver start on boot again? darkleaf Linux - Software 1 07-07-2005 08:20 AM
howto start a perl script only from tuesday to friday at 8.00 am ? cccc Linux - Newbie 4 03-19-2005 04:23 AM
Help with Howto start a shell script at boot draven Linux - Newbie 7 03-03-2004 11:20 PM
howto start vpnclient with php script and sudo ? cccc Programming 1 01-12-2004 11:46 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:46 PM.

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