Open Source Library (UK)

Tuesday, February 14, 2006

a quick and dirty way to get scripts to start with the system in debian

i appologise but i cannot remember where i found this as it was so long ago. this script is very quick and dirty and is useless past simple uses, if youre program requires a proper startup, restart and shutdown script then don't use this, YOU HAVE BEEN WARNED! i use it for my firewall. basically take a simple script such as the reboot (/etc/init.d/reboot) script and modify it to your needs, for me, it just points to my firewall:

#! /bin/sh
#
# reboot Execute the reboot command.
#
# Version: @(#)reboot 2.75 22-Jun-1998 miquels@cistron.nl
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

echo -n "Rebooting... "
reboot -d -f -i

converted to:
#! /bin/sh
#
#
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

echo "Starting Firewall and NAT"
/home/firewall-scripts/firewall


once created (and left in the /etc/init.d directory) call update-rc.d path/to/filename defaults to get it added to all the default debian startups, if you want to manually work out which runlevels it should start on, read the update-rc.d manual

0 Comments:

Post a Comment

<< Home