This is a discussion on List of services within the Linux Administration forums, part of the Linux Forums category; Hello everybody ! The command /sbin/chkconfig --list give the list of the services activated or disabled depending of the run-...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello everybody !
The command /sbin/chkconfig --list give the list of the services activated or disabled depending of the run-level. The result is given in plain text, translated to french for example for me. For example : oki4daemon 0:Arrêt 1:Arrêt 2:Arrêt 3:Arrêt 4:Arrêt 5:Arrêt 6:Arrêt portmap 0:Arrêt 1:Arrêt 2:Arrêt 3:Marche 4:Marche 5:Marche 6:Arrêt My question is : Is there a way to know exactly the same thing, with the result, not in plain text, but in numerical, with 0 for disabled and 1 for activated for example. oki4daemon 0:0 1:0 2:0 3:0 4:0 5:0 6:0 portmap 0:0 1:0 2:0 3:1 4:1 5:1 6:0 Thank a lot. Thibault |
|
|||
|
"tibo" <bartol_78SPAMSUX@yahoo.com> wrote in message
news:9a4fcfb22569876b37670e2737995f23@news.teranew s.com... > Hello everybody ! > > The command /sbin/chkconfig --list give the list of the services activated > or disabled depending of the run-level. The result is given in plain text, > translated to french for example for me. > > For example : > oki4daemon 0:Arrêt 1:Arrêt 2:Arrêt 3:Arrêt 4:Arrêt 5:Arrêt 6:Arrêt > portmap 0:Arrêt 1:Arrêt 2:Arrêt 3:Marche 4:Marche > 5:Marche 6:Arrêt > > My question is : > > Is there a way to know exactly the same thing, with the result, not in plain > text, but in numerical, with 0 for disabled and 1 for activated for example. > > oki4daemon 0:0 1:0 2:0 3:0 4:0 5:0 6:0 > portmap 0:0 1:0 2:0 3:1 4:1 5:1 6:0 > > Thank a lot. > > Thibault > > You could just pipe the output through a little sed script: |sed -e 's/Marche/1/g' -e 's/Arrêt/0/g' -- Jonathan. |
|
|||
|
Thank you for your answer.
My problem is that I want to get rid of the language. The matter is that, if I connect to an english or a chinese (!) Linux, this script won't work. In this case, I'd have to make as many scripts as languages, and a script to detect the language. That's why I need a command on the system that gives me a numerical result. And maybe the command chkconfig --list takes the informations in a file ? If you know a solution, please tell me. Thanks again. <jb> a écrit dans le message de news:3ffe7eb3$0$15346$afc38c87@news.easynet.co.uk. .. > "tibo" <bartol_78SPAMSUX@yahoo.com> wrote in message > news:9a4fcfb22569876b37670e2737995f23@news.teranew s.com... > > Hello everybody ! > > > > The command /sbin/chkconfig --list give the list of the services activated > > or disabled depending of the run-level. The result is given in plain text, > > translated to french for example for me. > > > > For example : > > oki4daemon 0:Arrêt 1:Arrêt 2:Arrêt 3:Arrêt 4:Arrêt 5:Arrêt 6:Arrêt > > portmap 0:Arrêt 1:Arrêt 2:Arrêt 3:Marche 4:Marche > > 5:Marche 6:Arrêt > > > > My question is : > > > > Is there a way to know exactly the same thing, with the result, not in > plain > > text, but in numerical, with 0 for disabled and 1 for activated for > example. > > > > oki4daemon 0:0 1:0 2:0 3:0 4:0 5:0 6:0 > > portmap 0:0 1:0 2:0 3:1 4:1 5:1 6:0 > > > > Thank a lot. > > > > Thibault > > > > > You could just pipe the output through a little sed script: > |sed -e 's/Marche/1/g' -e 's/Arrêt/0/g' > -- > Jonathan. > > |
|
|||
|
"tibo" <bartol_78SPAMSUX@yahoo.com> wrote in message
news:9a4fcfb22569876b37670e2737995f23@news.teranew s.com > The command /sbin/chkconfig --list give the list of the services > activated or disabled depending of the run-level. The result is given > in plain text, translated to french for example for me. > > For example : > oki4daemon 0:Arrêt 1:Arrêt 2:Arrêt 3:Arrêt 4:Arrêt 5:Arrêt > 6:Arrêt portmap 0:Arrêt 1:Arrêt 2:Arrêt 3:Marche > 4:Marche 5:Marche 6:Arrêt > > My question is : > > Is there a way to know exactly the same thing, with the result, not > in plain text, but in numerical, with 0 for disabled and 1 for > activated for example. > > oki4daemon 0:0 1:0 2:0 3:0 4:0 5:0 6:0 > portmap 0:0 1:0 2:0 3:1 4:1 5:1 6:0 Relatively trivial, as a matter of fact. In the ~/.bash_profile or ~/.bashrc or at a command line: alias "chkconfig"="/sbin/chkconfig --list | sed -e 's/Arrêt/0/g' -e 's/Marche/1/g' " This will allow the command "chkconfig" to expand to what you desire. Of course, to unalias the command for normal usage, one would precede the command with a backslash: \chkconfig --list if /sbin is in $PATH, or simply /sbin/chkconfig --list tony -- use hotmail for any email replies -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =----- |
|
|||
|
"tibo" <bartol_78SPAMSUX@yahoo.com> wrote in message
news:47516530349bc872750f820bc4afebf3@news.teranew s.com > The matter is that, if I connect to an english or a chinese (!) > Linux, this script won't work. > In this case, I'd have to make as many scripts as languages, and a > script to detect the language. > > That's why I need a command on the system that gives me a numerical > result. That's the beauty of an open-source operating system. Edit the source code and recompile it. -- use hotmail for any email replies -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =----- |
|
|||
|
tibo <bartol_78SPAMSUX@yahoo.com> wrote:
> Thank you for your answer. > > My problem is that I want to get rid of the language. > > The matter is that, if I connect to an english or a chinese (!) Linux, this > script won't work. > In this case, I'd have to make as many scripts as languages, and a script to > detect the language. > > That's why I need a command on the system that gives me a numerical result. > And maybe the command chkconfig --list takes the informations in a file ? > > If you know a solution, please tell me. LANG=C You'll find this in startup scripts, so that the output is predictable, from a Natural Language POV. LANG=C chkconfig --list | sed -e 's/Marche/1/g' -e 's/Arr?t/0/g' Actually, if you just want it to be uniform, just use LANG=C in all your scripts, so put this at the start of all your scripts. #!/bin/sh LANG=C -- Cameron Kerr cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/ Empowered by Perl! |
|
|||
|
"Cameron Kerr" <cameron.kerr@paradise.net.nz> a écrit dans le message de news:400240b1@news.orcon.net.nz... > tibo <bartol_78SPAMSUX@yahoo.com> wrote: > > Thank you for your answer. > > > > LANG=C > > You'll find this in startup scripts, so that the output is predictable, > from a Natural Language POV. > > LANG=C chkconfig --list | sed -e 's/Marche/1/g' -e 's/Arr?t/0/g' > > Actually, if you just want it to be uniform, just use LANG=C in all your > scripts, so put this at the start of all your scripts. > > #!/bin/sh > LANG=C I'm going to see that, I think it could be a great solution. Thank you for your answer. |