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?

-----BEGIN PGP SIGNED MESSAGE-----
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?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJK57ZBAAoJEF+XTK08PnB5XScP/36Ji/8zaf1CZ8brqzZ8dC7Y
P6WFqyPYeMV4/1KRt8AV9jC6ijmZsbxsMXNrEfw0RLUFEd5Pka4EvPMR6VviPjie
8NEMMZnsuDb/8JIwC0TVYkPqIKqqPjY/LCWGAyR/eX8LobbD6v235brCpGgP/Xcc
5GLGzs3nZvSCY2m4GcvaTtXQRDKM2372DAAOsUvOXMA/a6bv/YqLAmX48K2UYfuG
C+Rg0i05feEcTWNrvh/4EV4Irtm3ooIrXpnXrKMlqePUVikjNUwgA9zl2LWRrdh4
l2yWzNPF3Q1wdwS579ygOkMLe9AkQK1NraH8g14S9rIHL48o3RrgYSIAeccHrYsi
UBj2PF/+IJTF7qawuoSdim97NXsJjuYE9nNps7xfeXF25MZyDQmTZ+uNbPhmRJLZ
/GLqcrP2HWX/Bgw4ukPScotgpPFcw6Wkf6LrVctwDsV2TVmHjyBwKgjXaOB2T97L
QoLtx/fVzBuY4QVP2GetkFFa+VxIEktRZN4B+RQ8Edd5UXGif36oX+leTXID7GHF
5en+bFuirsdFKutfNSV0mxOzaltSBbWgcHCDjvYznpmgjDLqz1CxlAhG6bU6lYhY
maKDBgxQAEjAahoiHgS/OIQt8CG+zC5yAfbqPTlPYKzVxcUbsSZzExTdRUkYvoUv
a1/f1hVgj1e+mKVOCYYf
=5xfR
-----END PGP SIGNATURE-----

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

/home/mydirectory/myscript

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