Re: help adding start and shutdown script
- From: James A <james@xxxxxxx>
- Date: Mon, 27 Mar 2006 19:04:58 GMT
Jan Gerrit Kootstra wrote:
Matthäus Banach wrote:This script seems like a good solution. However, I don't understand how the system knows when to execute the 'start_net' script on system startup. Don't we have to have a link in /etc/init.d/rc5.d and likewise in /etc/init.d/rc0.d for the shutdown script. Do I create a symlink to your script in those directories so it will be executed at startup, reboot and shutdown?
Hi James,Hi James and Matthäus,
If you're using Gnome, you can start gnome-control-center and configure Gnome to start your ./start_net script at every logon. (As I use a localized version, I don't know what the icon inside the gnome-control-center is called, but it has to be something like "Sessions").
If you want Linux to look into the current directory for executables, just set the PATH variable. In bash you have to edit ~/.bash_profile.
If you add
PATH=$PATH:. # sets the PATH variable to the value it had
# before PLUS ".", the current directory
export PATH # exports the variable
to the file, it will do the trick.
Greetings from Germany,
Matthäus Banach
James A schrieb:
I have a customized driver for my wireless card running on Fedora Core 2.
To activate the card I have cd to a script directory and type "./start_net"
and to shut it down I type "./stop_net". How do I make them work without
having to type "./" before the command? I want to create a symlink to
/etc/rc.d/rc5.d so the wireless card starts automatically on boot up.
Matthäus approach has one disadvantage: A start script will not read profiles.
I would make a script /etc/init.d/mywireless like this:
-----------------------------------
CUT begin of script
----------------------------------
# chkconfig: - 99 1
# description: start/stop my wireless card
#
fullpath=thepathtothescriptdirectory
start() {
$fullpath/start_net
RETVAL=$?
return $RETVAL
}
stop() {
$fullpath/stop_net
RETVAL=$?
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RETVAL
---------------------------------------
CUT end of script
---------------------------------------
To make the mywiresless script work:
chmod 711 /etc/init.d/mywireless
chckonfig --add mywireless
chkconfig mywireless on
Good luck,
Jan Gerrit Kootstra
.
- Follow-Ups:
- References:
- help adding start and shutdown script
- From: James A
- Re: help adding start and shutdown script
- From: Matthäus Banach
- Re: help adding start and shutdown script
- From: Jan Gerrit Kootstra
- help adding start and shutdown script
- Prev by Date: Re: Redhat Syslog not working - Unix gurus help !
- Next by Date: Re: help adding start and shutdown script
- Previous by thread: Re: help adding start and shutdown script
- Next by thread: Re: help adding start and shutdown script
- Index(es):
Relevant Pages
|