Bash script on system startup

Sometimes I can’t understand why there is no docs for standart actions in Linux… The old OS and…
How can I run bush script on system startup?

Hash: SHA1

This is basically all the init scripts do. Copy /etc/init.d/skeleton to
/etc/init.d/yourservice and then modify it to do whatever you want to when
the ‘start’ parameter is fed to it. Set it to run during your preferred
runlevels (3 and 5 are the most-common ones, though 2 and maybe even 1
could be appropriate, though typically 1 is avoided unless you really know
what you’re doing). This will run as root so change any permissions
(sudo, startproc, etc.) as needed to modify that.

Along with that it would be useful to know what you specifically needed to
do. The instructions above answer your literal question but if you are
trying to do something that you may think belongs in a startup script but
which actually belongs elsewhere the text above isn’t going to help much.

Good luck.

toldforc wrote:
> Sometimes I can’t understand why there is no docs for standart actions
> in Linux… The old OS and…
> How can I run bush script on system startup?
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


There’s an extensive series of books and chapters installed on your computer relating to openSUSE. One chapter is on Bash Scripting (Chapter 18). There are many many topics. Check it out in your filesystem.

The index is at this address: /usr/share/doc/manual/opensuse-manual_en/manual/index.html

You’ll find lots more documentation in that filesystem tree.

Additional documentation about the init scripts can be found here: Packaging/SysV Init Script - openSUSE. Even though it is intended for an audience of packagers it contains a lot of useful documentation for users as well.

Firstly, thanks to all.
Second - i’m newbie, and have a very simple #!/bin/bash script which is connects me to internet via usb modem. And every time i ran it mannualy. Where should I place this script? In which file should I print the way to this script in order to make it run on rl3? Is it hard and many steps way? Should I read a lot of documentation about bash?
p/s/ I’ve opened /etc/init.d/skeleton. Didn’t understand how can it help me

The excellent suggestions given above will give you a script that runs during initial bootup. /etc/init.d contains all of the startup scripts. Look at the links provided, and/or do a quick “man service” and “man chkconfig” at a terminal prompt for more info.

If you just want to start your modem after you’ve logged in, there might be an easier way (just a suggestion). Assuming you use KDE, look at the .xinitrc file. There’s a place in there that says, “insert your lines here.” Put the invocation for your bash script there.

Even though I’m not sure it’s required in this case, it’s always a good idea to give the full path to a script: you’d add the line


… or something like that. Remember to make the script executable (though you’ve probably already done that).