Re: help adding start and shutdown script



Matthäus Banach wrote:
Hi James,

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.


Hi James and Matthäus,


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
.



Relevant Pages

  • Re: How dial outside of KDE/Gnome ???
    ... ]>>> I can dial my ISP nicely from KDE or Gnome. ... Worked fine in command line driven mode (even script ...
    (comp.os.linux.networking)
  • Re: PATH ~/bin under gnome
    ... not on the gnome environment. ... Right - ~/.bashrc works when you call stuff from the command line. ... you want to run a script that has a graphical front end (using ... If, on the other hand, you want to use a GNOME menu item or panel launcher ...
    (Ubuntu)
  • Re: Can not see my desktop in vnc session that is started up from local display.
    ... I meant not to add the gnome-session at the end of the xstartup script. ... What should I do in Debian to have the desktop in VNC session? ... I see you're starting a Gnome session; ...
    (Debian-User)
  • Re: Automating ripping
    ... It does require X but you don't have to run Gnome. ... like ripping only on partial track or start at certain sector) that you can ... I am not sure about detecting a CD insert and run the script ... freedb has its protocol published if you want to query their database. ...
    (RedHat)
  • Re: PATH ~/bin under gnome
    ... not on the gnome environment. ... Right - ~/.bashrc works when you call stuff from the command line. ... you want to run a script that has a graphical front end (using ... If, on the other hand, you want to use a GNOME menu item or panel launcher ...
    (Ubuntu)