![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
|
|
Server Platforms Discussion regarding any server based ubuntu release. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
5 Cups of Ubuntu
![]() |
chkconfig in Ubuntu?
How can I do a chkconfig on Ubuntu. That's I'm trying to do...
#chkconfig dhcp on and #chkconfig squid on under /etc/init.d Thanks guys! |
|
|
|
|
|
#2 |
|
Gee! These Aren't Roasted!
![]() Join Date: Jan 2005
Location: Clarkston, MI
Beans: 207
Ubuntu 9.04 Jaunty Jackalope
|
Re: chkconfig in Ubuntu?
check out update-rc.d
man update-rc.d |
|
|
|
|
|
#3 |
|
5 Cups of Ubuntu
![]() |
Re: chkconfig in Ubuntu?
I tried update-rc.d but the services (dhcp & squid) are not starting automatically. When I ran the command it says that "the links already exist"
|
|
|
|
|
|
#4 |
|
Dark Roasted Ubuntu
![]() Join Date: Jan 2005
Location: London
Beans: 1,097
|
Re: chkconfig in Ubuntu?
I think chkconfig is nice as well (actually, coming from an SGI Irix background as well as Redhat). But I doubt you'll see it on Ubuntu soon.
update-rc.d is a bit more sensitive - but does work. To see what links are around for "squid" say, try a : find /etc/rc* -name '*squid*' Also check the logs for startup problems (and the /etc/init.d file). Last edited by alastair; March 18th, 2005 at 06:03 PM.. Reason: typo |
|
|
|
|
|
#5 |
|
First Cup of Ubuntu
![]() Join Date: Feb 2005
Beans: 6
|
Re: chkconfig in Ubuntu?
Here ya go:
Code:
#!/bin/bash
#----------------------------------------------------------------
# Title: rc-config
# Author: Joseph Harrison
# Date Created: 12/16/2005
# Date Modified: 12/16/2005
# Purpose: Configure services and run-levels
# Dependencies: grep, sed, update-rc.d
#----------------------------------------------------------------
USAGE="Usage: rc-config [OPTION] [SERVICE ... STATE]\n\
Information about services and run-levels, configure services and run-levels\n\
Sorts entries alphabetically\n\
\n\
Mandatory arguments to long options are mandatory for short options too.\n\
-h,\t\t\t Show help\n\
-l,\t\t\t List all services and run-levels\n\
-ls <service>,\t\t List a specific service and run-levels\n\
-s <service> <off|on>,\t Configure service\n\
\t\t\t Ex: rc-config -s ssh off\n\
-t,\t\t\t Terse output\n\n"
LISTSVC=0
SETSVC=0
TERSE=0
checkroot(){
if [ $EUID -ne 0 ]
then
echo "you must be root to use this feature"
exit 1
fi
}
checkopts()
{
while getopts "lsth" flag
do
case $flag in
l ) LISTSVC=1;;
s ) SETSVC=1;;
t ) TERSE=1;;
h ) echo -en $USAGE;
exit 1;;
* ) echo -en $USAGE
exit 1;;
esac
done
if [ -z "$1" ]
then
echo -en $USAGE
fi
}
showrc(){
if [ $TERSE -eq 0 ]
then
echo -en "SERVICE\t\t\tRUN-LEVELS\n"
fi
if [ $SETSVC -eq 0 ]
then
slist=`find /etc/init.d/ -perm -100 \
| sed "s/\/etc\/init.d\///"`
elif [ $SETSVC -eq 1 ]
then
svc=$2
if [ -f "/etc/init.d/$svc" ]
then
slist="$svc"
else
echo "$svc: does not exist"
exit 1
fi
fi
for msvc in $slist
do
sln=18
tsvc=$msvc
while [ ${#tsvc} -lt $sln ]
do
tsvc="$tsvc "
done
echo -en "${tsvc:0:$sln}\t"
for level in 0 1 2 3 4 5 6
do
svcs=`ls -1 /etc/rc${level}.d/S* \
| sed "s/\/etc\/rc${level}.d\/S[0-9]*//"`
state=0
for svc in $svcs
do
if [ "$svc" = "$msvc" ]
then
state=1
continue
fi
done
if [ $state -eq 1 ]
then
echo -en "$level:on\t"
else
echo -en "$level:off\t"
fi
done
echo
done
}
setsvc(){
svc=$2
state=$3
if [ -z "$svc" ] || [ -z "$state" ]
then
echo -en $USAGE
exit 1
fi
if [ ! -f "/etc/init.d/$svc" ]
then
echo "$svc: does not exist"
exit 1
fi
if [ $state = "on" ]
then
update-rc.d $svc defaults
elif [ $state = "off" ]
then
echo "disabling service: $svc"
/etc/init.d/$svc stop > /dev/null
for link in `find /etc/rc* -type l -name "[S,K][0-9][0-9]$svc"`
do
unlink $link
done
else
echo -en $USAGE
fi
}
main(){
checkopts "$@"
if [ $LISTSVC -eq 1 ]
then
showrc "$@"
elif [ $SETSVC -eq 1 ]
then
checkroot
setsvc "$@"
fi
}
main "$@"
Last edited by jbharrison; January 9th, 2006 at 06:27 PM.. |
|
|
|
|
|
#6 |
|
Skinny Soy Caramel Ubuntu
![]() Join Date: Sep 2005
Location: Cedar Rapids, IA, USA
Beans: 594
Ubuntu 6.10 Edgy
|
Re: chkconfig in Ubuntu?
Thanks for the bash script. Will try it when I get home.
This is probably a better solution than attempting to get the RedHat chkconfig source and try to compile it against Kubuntu.
__________________
#399784 | Ubuntu User #287 | My Blog *** If you're going to program, install the damn build-essential package *** There is no such thing as Ubuntu specific programming Save the electrons - if you quote, trim! |
|
|
|
|
|
#7 |
|
First Cup of Ubuntu
![]() Join Date: Jan 2006
Location: EU
Beans: 2
Ubuntu 8.10 Intrepid Ibex
|
Re: chkconfig in Ubuntu?
There is an alternative for editing runlevels that can be used just like chkconfig:
http://sysv-rc-conf.sourceforge.net/ To install: sudo apt-get install sysv-rc-conf sysv-rc-conf Excerpt from the manual: DESCRIPTION sysv-rc-conf gives an easy to use interface for managing /etc/rc{runlevel}.d/ symlinks. The interface comes in two different flavors, one that simply allows turning services on or off and another that allows for more fine tuned management of the symlinks. It's a replacement for programs like ntsysv( sysv-rc-conf can also be used at the command line when the desired changes to the symlinks are already known. The syntax is borrowed from chkconfig( |
|
|
|
|
|
#8 |
|
Ubuntu Espresso Roast
![]() Join Date: Jan 2005
Location: Stockholm, Sweden
Beans: 59
The Feisty Fawn Testing
|
Re: chkconfig in Ubuntu?
Thank you very much!
sysv-rc-conf is almost like chkconfig! |
|
|
|
|
|
#9 |
|
Just Give Me the Beans!
![]() Join Date: Nov 2006
Location: East Yorkshire, England
Beans: 66
Ubuntu 9.04 Jaunty Jackalope
|
Re: chkconfig in Ubuntu?
If you actually want the chkconfig command in ubuntu, do the following:
Code:
$ apt-get install libnewt0.51 $ ln -s /usr/lib/libnewt.so.0.51 /usr/lib/libnewt.so.0.50 $ wget http://www.tuxx-home.at/projects/chkconfig-for-debian/chkconfig_1.2.24d-1_i386.deb $ dpkg --force-all -i chkconfig_1.2.24d-1_i386.deb |
|
|
|
|
|
#10 | ||
|
A Carafe of Ubuntu
![]() Join Date: Jul 2006
Beans: 90
|
Re: chkconfig in Ubuntu?
Quote:
Quote:
btw, apt is the reason I switched to Debian. apt > yum |
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|