Jump to content

Newbie needs script help


Recommended Posts

Hi folks,

I'm running mandrake 10.1 and I am trying to run a script when the system boots up and then another script when the system shutsdown. The scripts basically setup my wireless pci card using the acx100 drivers and I would like for my system to sort this out without me having to type './start_net' or './stop_net' all the time. Is there a simple way to do this? Sorry if this is a really dumb question.

 

Cheers

Lee

 

[moved from Software by spinynorman - welcome aboard :)]

Link to comment
Share on other sites

Use this as a template and place it in /etc/init.d Then use the services menu in the mandrake control center to run the script at runlevel 2, 3 , 4 and 5

#!/sbin/runscript
#
# start stop script
# /etc/init.d/custom-init-script

depend() {
       need net
}

checkconfigstart() {
       if [ ! -e "/path/to/startscript.sh" ]; then
               eerror "You need a script to run first"
               eerror "make sure that you chmod +x the .sh"
               return 1
       fi
}

checkconfigstop() {
       if [ ! -e "/path/to/startscript.sh" ]; then
               eerror "You need a script to run first"
               eerror "make sure that you chmod +x the .sh"
               return 1
       fi
}

start() {
       checkconfigstart || return 1
       ebegin "put what your script does here IE: loading wireless card"
       /path/to/startscript.sh
       eend $?
}

stop() {
       checkconfigstop || return 1
       ebegin "put what your script does here IE: stoping wireless card"
       /path/to/stopscript.sh
       eend $?
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...