[arch-general] Creation of startup scripts
Hi all, I am learning more and more about Linux, but I would like to learn how to create startup scripts for my programs, any good resource? Where should I start? Many thanks, Christian
If you mean bash scripting, this is a good beginner's guide: http://mywiki.wooledge.org/BashGuide Otherwise you will have to provide some more information on exactly what you want to do. On Tue, Oct 5, 2010 at 4:55 PM, Christian <christian08@runbox.com> wrote:
Hi all, I am learning more and more about Linux, but I would like to learn how to create startup scripts for my programs, any good resource? Where should I start? Many thanks, Christian
"Christian" <christian08@runbox.com>:
Hi all, I am learning more and more about Linux, but I would like to learn how to create startup scripts for my programs, any good resource? Where should I start? Many thanks, Christian
Take some initscript from /etc/rc.d, copy and adjust it to your needs. -- Gruß, Johannes http://hehejo.de
Hi, On 2010-10-05 at 23:00 Johannes Held wrote:
"Christian" <christian08@runbox.com>:
Hi all, I am learning more and more about Linux, but I would like to learn how to create startup scripts for my programs, any good resource? Where should I start? Many thanks, Christian
Take some initscript from /etc/rc.d, copy and adjust it to your needs.
-- Gruß, Johannes http://hehejo.de
I have already done that, but it would be nice to know if some things should be included or not in the scripts. I would also like to get started in creating aur packages. But this is bash scripts?
"Christian" <christian08@runbox.com>:
I would also like to get started in creating aur packages. But this is bash scripts? Jep, nearly everything on ArchLinux is made via bash (exceptions are pacman and friends).
Whether you want to crreate aur packages or alter provided packages you need to learn about PKGBUILD and the ABS (ArchBuildSystem). Go read the wiki about them - it's really easy and fast forward! -- Gruß, Johannes http://hehejo.de
Hi, On 2010-10-05 at 23:38 Johannes Held wrote:
I would also like to get started in creating aur packages. But this is bash scripts? Jep, nearly everything on ArchLinux is made via bash (exceptions are
"Christian" <christian08@runbox.com>: pacman and friends).
Whether you want to crreate aur packages or alter provided packages you need to learn about PKGBUILD and the ABS (ArchBuildSystem). Go read the wiki about them - it's really easy and fast forward!
-- Gruß, Johannes http://hehejo.de
OK, just want to be sure if I want to create rc scripts I should read up on bash scripting?
"Christian" <christian08@runbox.com>:
OK, just want to be sure if I want to create rc scripts I should read up on bash scripting? Hehe, that depends! If you need to do really complicated things - yes! If you simply want to start some program like you would from shell - no!
-- Gruß, Johannes http://hehejo.de
On Wed, 2010-10-06 at 00:22 +0200, Johannes Held wrote:
"Christian" <christian08@runbox.com>:
OK, just want to be sure if I want to create rc scripts I should read up on bash scripting? Hehe, that depends! If you need to do really complicated things - yes! If you simply want to start some program like you would from shell - no!
The shell is bash, anyway....
Hi, On 2010-10-06 at 00:22 Johannes Held wrote:
"Christian" <christian08@runbox.com>:
OK, just want to be sure if I want to create rc scripts I should read up on bash scripting? Hehe, that depends! If you need to do really complicated things - yes! If you simply want to start some program like you would from shell - no!
-- Gruß, Johannes http://hehejo.de
I want to start my programs at boot time from /etc/rc.d OK i will read up on bash scripting then and see what I can come up with! I just want to understand what certain things mean and if I can leave them out or not when I copy and use other scripts to stat programs. Christian
On Tue, Oct 5, 2010 at 6:59 PM, Christian <christian08@runbox.com> wrote:
I want to start my programs at boot time from /etc/rc.d OK i will read up on bash scripting then and see what I can come up with! I just want to understand what certain things mean and if I can leave them out or not when I copy and use other scripts to stat programs. Christian
man bash, and read the existing init scripts. the stuff in arch is, as far as i've seen, clean and well commented. bash scripting has a lot of quirky little edge areas though, so it can be hard to ease into. Chapters 7-9 of http://rute.2038bug.com/rute.html.gz and the whole of http://tldp.org/LDP/abs/html/ helped me out when I was starting to get into bash scripting. that was back in 2002 or so, so there may be better resources available. oh, and don't expect to read all of the bash man page at once. it's huge, and filled with all kinds of treasure. tinker, and don't be afraid to break things! (you may want to make sure you won't be losing anything hugely important before not fearing breakage ... ). you'll wake up one day and realize you're the master of your machine, and a glorious day it will be.
On 10/06/2010 07:59 AM, Jeremiah Dodds wrote:
man bash, and read the existing init scripts. the stuff in arch is, as far as i've seen, clean and well commented. bash scripting has a lot of quirky little edge areas though, so it can be hard to ease into. Chapters 7-9 of http://rute.2038bug.com/rute.html.gz and the whole of http://tldp.org/LDP/abs/html/ helped me out when I was starting to get into bash scripting. that was back in 2002 or so, so there may be better resources available.
oh, and don't expect to read all of the bash man page at once. it's huge, and filled with all kinds of treasure.
tinker, and don't be afraid to break things! (you may want to make sure you won't be losing anything hugely important before not fearing breakage ... ). you'll wake up one day and realize you're the master of your machine, and a glorious day it will be.
100% agree. http://tldp.org/LDP/abs/html with its list of examples is probably the finest BASH reference available. In the Advanced BASH Scripting-Guide (abs) you will find examples listed at the end of each section like this: ----- 10.1.2. Further Reference For more on string manipulation in scripts, refer to Section 10.2 and the relevant section of the expr command listing. Script examples: 1. Example 16-9 2. Example 10-9 <snip> ----- ** don't skip the examples :p Additionally, another great resource I found was looking/working through scripts that did something close to what I needed to do. Especially if they are well commented. (try to comment your scripts for those that will read them to learn in the future) BASH has so many amazing tools and tricks, that it is hard to pick a few of the favorites. Test constructs, loops and arrays for sure, but probably the most helpful was taking the time to learn parameter substitution and string manipulation. (how to get what you need out of a long string of text, string length, index, etc..) BASH is particularly good at being a swiss-army knife on strings. You will always be faced with variables that hold a sting that contains lots of information that you only need 1 part of. The BASH parameter and sub-string capabilities will save you untold grief if you learn them up front. I particularly like: http://tldp.org/LDP/abs/html/parameter-substitution.html and http://tldp.org/LDP/abs/html/string-manipulation.html as pages to bookmark, get familiar with, and then go back and learn (I haven't used the 'expr ..' functions much, but everything else is a must). Also, keep the quick reference handy: http://tldp.org/LDP/abs/html/refcards.html Good luck! -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
On Tue, Oct 5, 2010 at 3:55 PM, Christian <christian08@runbox.com> wrote:
Hi all, I am learning more and more about Linux, but I would like to learn how to create startup scripts for my programs, any good resource? Where should I start? Many thanks, Christian
Startup scripts are pretty specific to each distro. * http://wiki.archlinux.org/index.php/Writing_rc.d_scripts * http://www.justinbritten.com/work/2009/05/god-initd-script-for-centos/ -Dan
Hi, On 2010-10-05 at 16:02 Dan McGee wrote:
On Tue, Oct 5, 2010 at 3:55 PM, Christian <christian08@runbox.com> wrote:
Hi all, I am learning more and more about Linux, but I would like to learn how to create startup scripts for my programs, any good resource? Where should I start? Many thanks, Christian
Startup scripts are pretty specific to each distro. * http://wiki.archlinux.org/index.php/Writing_rc.d_scripts * http://www.justinbritten.com/work/2009/05/god-initd-script-for-centos/
-Dan
Yes, it's rc.d scripts I would like to write. Christian
participants (7)
-
Christian
-
Dan McGee
-
David C. Rankin
-
Jeremiah Dodds
-
Johannes Held
-
Ng Oon-Ee
-
Ryan Williams