LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

Rep: Reputation: 15
Howto start script at boot ?


Hi,

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?

Thanks.
Jimmy
 
Old 11-08-2005, 07:22 AM   #2
PsypherPunk
Member
 
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
john2
Member
 
Registered: Aug 2004
Location: UK
Distribution: SolydK, Kubuntu, Mageia, OpenSUSE
Posts: 74

Rep: Reputation: 22
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
hendrixx
Member
 
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 :

Code:
#! /bin/sh
### BEGIN INIT INFO
# 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.)
### END INIT INFO

DAEMON=/etc/init.d/firewall

test -x $DAEMON || exit 0

. /etc/rc.status
rc_reset

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

    restart)
    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/firewall.pid --exec $DAEMON
    rc_status -v
    ;;

    *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac
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.

Cheers
Jimmy
 
  


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
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


All times are GMT -5. The time now is 10:14 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