[Pkg-sysvinit-devel] Bug#307929: run level viewer

jidanni at jidanni.org jidanni at jidanni.org
Tue Apr 7 22:55:49 UTC 2009


By the way, I wrote this...

#! /usr/bin/perl
# View SYSV run levels
# usage: $0; meanings: xx- is start, -xx is stop
# Copyright       : http://www.fsf.org/copyleft/gpl.html
# Author          : http://jidanni.org/
# Created On      : Sun Apr  5 03:14:40 2009
# Last Modified On: Sun Apr  5 03:16:59 2009
# Update Count    : 4
use warnings FATAL => 'all';
use strict;
use File::Find ();
use vars qw/*name/;
*name   = *File::Find::name;
my $char="-";
my %h;
my @levels=('S',0..6);
File::Find::find({wanted => \&wanted}, </etc/rc?.d/?[0-9][0-9]*>);
sub wanted {
    $name=~m@/etc/rc(.)\.d/(.\d\d)(.*)@;
    my $t=$2;
    for($t){s/K(..)/$1$char/||s/S(..)/$char$1/}
    $h{$3}{$1}=$t;
}
$h{LEVEL}{$_}=" $_ " for @levels;
for my $key(sort keys %h){
    print exists $h{$key}{$_}?$h{$key}{$_}:"   ","|" for @levels;
    print "$key\n";
}





More information about the Pkg-sysvinit-devel mailing list