Jump to content

how to auto start a script at startup [solved]


Recommended Posts

I am a fairly new linux convert, still having some basic troubles...

I have recently got my Belkin f5d7000 card working in mandrake 10.2, and have made a small script called 'wireless.sh' to configure things like essid, encryption key and route to use. I have to run this every time I boot up in order to get the wireless working. Is there a way to make this script run by itself on startup? I am using kde and saw a post somewhere here that said to put the file in home/user/.kde/Autostart - which I did, but nothing happened and I still have to start the script myself. I ticked the box in the properties part of the script (in Konqueror) to enable the file to be executable, and the permissions are set correctly I think... I need to be root to run the script in a terminal, so maybe this could be the problem? Any help would be wildly appreciated, I love linux for the way it can be configured to do what I want, but I lack the knowledge to do this stuff straight up.

 

once again, thanks

Crundle

Edited by crundle
Link to comment
Share on other sites

The script has to be run as root. The stuff in the kde Autostart directory is started as an ordinary user. It's not hard to do though. Copy and paste your script into the bottom of /etc/rc.d/rc.local. rc.local runs with root privilege and executes after all the other init scripts run. You need to be root to edit the file so run:

 

$ kdesu kwrite /etc/rc.d/rc.local

 

Ener the root password when prompted and rc.local will come up in kwrite with root privileges.

Link to comment
Share on other sites

thanks for the help pmpatrick! I have jsut entered the commands, but I am off to work now, and downloading something, so I will have to wait until tonight to reboot and see if it comes up (not worried about your information, just my typing!) Thanks for the help, its the community feeling that makes linux rock

 

crundle

:)

Link to comment
Share on other sites

yep! worked a treat!

 

thanks for the help, it would have taken me forever to learn that myself. thanks especially for the rapid response to my question.

 

cheers,

crundle

 

:)

Link to comment
Share on other sites

  I ticked the box in the properties part of the script (in Konqueror) to enable the file to be executable, and the permissions are set correctly I think...  I need to be root to run the script in a terminal, so maybe this could be the problem?  Any help would be wildly appreciated, I love linux for the way it can be configured to do what I want, but I lack the knowledge to do this stuff straight up. 

 

once again, thanks

Crundle

in order for you to run the script as a regular user, try to ,as root#chmod a+x wireless.sh ....a = all, which means that all user can x= execute that script, but if the script contains shell commands that only root have access, though you can run the script but it will fail, well, as per pmpatrick, that should work

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