First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 4222
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Martin Schlemmer (RETIRED) <azarah@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Sean E Russell <gentoobugs@ser.fdns.net>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
rc-status A script to provide summary information about the system RC status text/plain Sean E Russell 2002-06-26 23:06 0000 8.58 KB Details
service A really, really small script that is really, really convenient. text/plain Sean E Russell 2002-06-26 23:07 0000 54 bytes Details
rc-status.patch A patch to catch missing directories in /mnt/.init.d patch Sean E Russell 2002-06-27 21:20 0000 1.55 KB Details | Diff
rc-status.patch.2 Incremental patch to fix nil error patch Sean E Russell 2002-06-28 11:40 0000 776 bytes Details | Diff
rc-status-bash the /usr/sbin/rc-status script rewritten in bash text/plain SpanKY 2002-08-02 07:49 0000 8.91 KB Details
rc-update.show.patch rc-update patch to list services patch Max Kalika (RETIRED) 2002-12-30 02:14 0000 1.20 KB Details | Diff
rc-status updated rc-status (works with latest baselayout) text/plain SpanKY 2003-02-16 20:46 0000 7.53 KB Details
rc-status more touchups text/plain SpanKY 2003-02-16 20:49 0000 6.70 KB Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 4222 depends on: 2462 Show dependency tree
Bug 4222 blocks: 5820
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2002-06-26 23:04 0000
Here are a couple of scripts which I find useful. 
 
The first is trivial; it is a port of Redhat's (& Mandrake's) 'service' script.  
It's all of three lines.  It allows the user to say 'service qmail restart' 
rather than '/etc/init.d/qmail restart', and it is amazingly handy for such a 
stupid little script.  The reason being that it is much easier to type.  Try 
it, you'll like it.  The script is in /bin/sh. 
 
The second script is more substantial.  I call this script rc-status, and it 
prints information about the rc services that are installed and their run 
status.  This provides an /overview/ of the RC system.  I find that it is very 
easy to have 'orphaned' init.d scripts; scripts which were installed, but never 
'enabled' with rc-update.  It took me a good three days after first installing 
Gentoo to realize that cron wasn't enabled by default :-/.  In any case, this 
script can be used to show the status of all services defined at this runlevel, 
as well as print out a list of all services which are installed but not enabled. 
 
By default, the script displays information about the current run level.  If a 
symbolic name is provided, it displays information about that run level 
instead.  If --all (-a) is provided, it displays information about all run 
levels, including 'orphaned' services.  If --unused (-u) is provided, it 
displays a list of services which are installed, but not assigned to any run 
level.  --help (-h) displays usage information.  --list (-l) shows a list of all 
run level symbolic names defined for the system.  --nocolors (-n) turns off 
colors in the output. 
 
The script is written in Ruby.  I don't do Python.  I commented it copiously, 
so if someone wants to do a conversion to Python, it shouldn't be difficult.  
There are 91 lines of non-blank, non-comment code; 185 with comments.  You 
could redo it in /bin/sh; more power to you.  I've got a low threshold for 
pain, so it is in Ruby. 
 
I'd like to see these either in baselayout, or one of the extension libraries, 
such as gentoolkit.  Wherever is appropriate.  I hesitate to make an entire 
ebuild for these two scripts, but I will if I need to. 
 
Thanks.

------- Comment #1 From Sean E Russell 2002-06-26 23:06:10 0000 -------
Created an attachment (id=1828) [details]
A script to provide summary information about the system RC status

------- Comment #2 From Sean E Russell 2002-06-26 23:07:26 0000 -------
Created an attachment (id=1829) [details]
A really, really small script that is really, really convenient.

------- Comment #3 From SpanKY 2002-06-27 19:16:06 0000 -------
rux0r root # rc-status
/usr/sbin/rc-status:149:in `open': No such file or directory -
 "/mnt/.init.d/failed" (Errno::ENOENT)
        from /usr/sbin/rc-status:149:in `entries'
        from /usr/sbin/rc-status:149

------- Comment #4 From Sean E Russell 2002-06-27 21:17:00 0000 -------
Hmm.  I didn't know that /mnt/.init.d/failed (and I'd assume
/mnt/.init.d/broken) was an optional directory.  I thought they were part of
the rc system.  In any case, I've attached a patch that fixes this problem, and
ignores those directories if they don't exist. 

------- Comment #5 From Sean E Russell 2002-06-27 21:20:11 0000 -------
Created an attachment (id=1843) [details]
A patch to catch missing directories in /mnt/.init.d

------- Comment #6 From SpanKY 2002-06-27 22:38:36 0000 -------
if you need more info about my setup to make this work, just ask

rux0r root # rc-status
Runlevel: default
  local                                                             [ started ]
  netmount                                                          [ started ]
  net.eth0                                                          [ started ]
  sshd                                                              [ started ]
  samba                                                             [ started ]
  metalog                                                           [ started ]
  dcron                                                             [ started ]
/usr/sbin/rc-status:176: undefined method `include?' for nil (NameError)
        from /usr/sbin/rc-status:171:in `each'
        from /usr/sbin/rc-status:171
        from /usr/sbin/rc-status:167:in `each'
        from /usr/sbin/rc-status:167
  apache

------- Comment #7 From Sean E Russell 2002-06-28 11:40:01 0000 -------
Created an attachment (id=1855) [details]
Incremental patch to fix nil error

This bug that vapier is seeing really shouldn't occur; it can't, theoretically,
occur.	However, this patch ensures that it doesn't occur.

------- Comment #8 From SpanKY 2002-06-28 13:11:19 0000 -------
i cant test out that patch on rux0r (the ps went up in smoke, literally) ...

ill tested it out on my desktop and it worked great :)

------- Comment #9 From Martin Schlemmer (RETIRED) 2002-06-28 15:05:19 0000 -------
*** Bug 2467 has been marked as a duplicate of this bug. ***

------- Comment #10 From Martin Schlemmer (RETIRED) 2002-06-28 15:10:26 0000 -------
Ok, just got home, and yesterday evening the power was out the whole night :(

Anyhow, rc-status looks like a gem, which we can either have in baselayout,
or maybe gentoolkit (will have to check with Karl).  Side note though, is if
in baselyout, ill rather like to have it in bash, using /etc/init.d/functions.sh
for output.  We can even change eend() to have a third optional parameter to
change the default output (ok, or status, etc).  My ruby sux though :/

Then for the service script.  We have talked about this before, and I dont like
it .. many other users/developers dont like it, or feel it is not safe (dont
want initscripts in $PATH).  I really feel it is a user-domain thing .. if
you want it, you can do the 3 lines of bash code.

------- Comment #11 From SpanKY 2002-06-28 15:29:54 0000 -------
Martin Schlemmer: where do you live ? my power went out last evening also ;)
which leads to why rux0r's PS went up in smoke

at any rate i would have to agree on both points ...
rc-status *should* be in bash (i lub bash, i had to bring down ruby on my boxes 
in order to test out your script)
the service thing should be a user preference ... if you want it, add the 3 
lines ... hell, make it an alias for the super user in /etc/profile ;)

------- Comment #12 From Sean E Russell 2002-06-28 16:23:03 0000 -------
'bash' /is/ the LCD, and there's good reason to have only bash scripts in the 
baselayout.  That said: 
  
1) All non-trivial bash scripts inevitably becoume unmanageable.  rc-status  
wouldn't be exactly trivial to implement in bash.  Therefore, I'd personally 
rather see it in gentoolkit than in baselayout if bashness is a prerequisite 
for baselayout. 
 
2) rc-status isn't exactly a core feature; nobody is going to die for not 
having rc-status installed. Another argument for having it in gentoolkit. 
 
3) If someone else wants to rewrite it in bash, that is fine by me.  I'm not  
going to do it, though :-)  
 
Martin sez: 
> for output.  We can even change eend() to have a third optional parameter to  
> change the default output (ok, or status, etc).  My ruby sux though :/  
 
I think the array operations would be the most complicated thing to translate 
to bash.  I think Python would be a better target for translation.  Most of 
Gentoo depends on Python, so it is installed by default.  I thoroughly dislike 
Python, though, so (again) I won't be doing a translation. 
  
> Then for the service script.  We have talked about this before, and I dont 
> like it .. many other users/developers dont like it 
 
Hm.  Yeah, I just found bug #2467.  Well, I'm coming from Redhat and Mandrake, 
and the 'service' function is a sanity feature.  Anybody who spends any real 
time doing sysadmin knows that you tend to call the rc scripts a lot by hand, 
when you're upgrading, installing, configuring, and fixing.  In any case, I 
don't really care if 'service' makes it into the distribution; I submitted it 
as an enhancement because I don't know of a better place for people to submit 
utility scripts, and as much as some Gentoo users may not like it, a lot of 
people coming from just about any of the other major distros are going to miss 
this basic functionality.  I thought I'd throw it out there. <shrug/> 
 
> or feel it is not safe (dont want initscripts in $PATH). 
 
This, I don't understand.  'service' doesn't put initscripts any nearer to the 
$PATH than prepending the full path does.  It is merely easier to type the word 
'service ' than '/etc/init.d/'. 
 
Oh, and I got the pun, Martin :-) 

------- Comment #13 From Martin Schlemmer (RETIRED) 2002-06-28 17:49:42 0000 -------
> 1) All non-trivial bash scripts inevitably becoume unmanageable.  rc-status  
> wouldn't be exactly trivial to implement in bash.  Therefore, I'd personally 
> rather see it in gentoolkit than in baselayout if bashness is a prerequisite 
> for baselayout. 
> 
> 2) rc-status isn't exactly a core feature; nobody is going to die for not 
> having rc-status installed. Another argument for having it in gentoolkit. 
 
> 3) If someone else wants to rewrite it in bash, that is fine by me.  I'm not  
> going to do it, though :-)  

True.

> I think the array operations would be the most complicated thing to translate 
> to bash.  I think Python would be a better target for translation.  Most of 
> Gentoo depends on Python, so it is installed by default.  I thoroughly dislike 
> Python, though, so (again) I won't be doing a translation. 

This was ideas for a bash rewrite.

>> or feel it is not safe (dont want initscripts in $PATH). 
> 
> This, I don't understand.  'service' doesn't put initscripts any nearer to the 
> $PATH than prepending the full path does.  It is merely easier to type the
> word 'service ' than '/etc/init.d/'.

This is not my argument .. just came up with a previous discussion.
 
> Oh, and I got the pun, Martin :-) 

Ok, I dont know what "pun" means ;)

------- Comment #14 From Martin Schlemmer (RETIRED) 2002-07-16 17:09:19 0000 -------
Hi Karl .. mind having a look at rc-status for inclusion in gentoolkit? 
Thanks.

------- Comment #15 From Dan Naumov 2002-08-01 01:15:28 0000 -------
I haven't tried this as I don't have Ruby installed, but from what I read here,
I'd vote for thsi to be re-writted in something that would allow it's inclusion
in the base system. To be honest, I don't understand why gentoolkit is not a
part of it either. Yes, you CAN survive without gentoolkit installed, but it's
small and who would NOT WANT to have it installed ?

------- Comment #16 From SpanKY 2002-08-02 07:49:12 0000 -------
Created an attachment (id=2738) [details]
the /usr/sbin/rc-status script rewritten in bash

since everyone wants it but noone wants to do it, please test this out and tell
me it works ;)
also, please audit the source code real quick as this is the first real bash
script ive done that doesnt consist of just 1 or 2 if statements

------- Comment #17 From Martin Schlemmer (RETIRED) 2002-08-07 16:35:20 0000 -------
*** Bug 5820 has been marked as a duplicate of this bug. ***

------- Comment #18 From SpanKY 2002-08-27 11:15:32 0000 -------
*** Bug 7123 has been marked as a duplicate of this bug. ***

------- Comment #19 From SpanKY 2002-08-27 18:52:43 0000 -------
*** Bug 7141 has been marked as a duplicate of this bug. ***

------- Comment #20 From SpanKY 2002-12-20 09:46:29 0000 -------
*** Bug 12479 has been marked as a duplicate of this bug. ***

------- Comment #21 From Matt Taylor 2002-12-20 23:20:49 0000 -------
I found this from Bug 12479, tested and it works great.  Whats the status of
this?  Is it going to be included in gentoolkit or what?

------- Comment #22 From Max Kalika (RETIRED) 2002-12-30 02:14:33 0000 -------
Created an attachment (id=6847) [details]
rc-update patch to list services

I know there were previous attempts at getting this functionality for
rc-update.  This is just an idea.  It adds a "show" command-line arg to
rc-update, which lists all available scripts in /etc/init.d and the runlevels
for which they'll execute.  If no runlevels are specified, rc-update will list
all runlevels otherwise just specified runlevels will be shown.  This patch
also ignores any .sh functionality scripts in /etc/init.d.

please be gentle... :-)

------- Comment #23 From SpanKY 2003-02-16 13:22:27 0000 -------
taking so i can add it 

------- Comment #24 From SpanKY 2003-02-16 20:46:48 0000 -------
Created an attachment (id=8349) [details]
updated rc-status (works with latest baselayout)

actually i lied, it doesnt belong in gentoolkit, it belongs in baselayout ...
back to you az ;)

------- Comment #25 From SpanKY 2003-02-16 20:49:30 0000 -------
Created an attachment (id=8350) [details]
more touchups

------- Comment #26 From Martin Schlemmer (RETIRED) 2003-08-04 11:31:41 0000 -------
Added to CVS (or about to), thanks guys.  Sorry for being so long overdue ...

First Last Prev Next    No search results available      Search page      Enter new bug