Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Server Platforms
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

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
Old March 17th, 2005   #1
ejms07
5 Cups of Ubuntu
 
ejms07's Avatar
 
Join Date: Mar 2005
Location: Puerto Rico
Beans: 33
Ubuntu 8.04 Hardy Heron
Send a message via ICQ to ejms07 Send a message via AIM to ejms07 Send a message via MSN to ejms07 Send a message via Yahoo to ejms07
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!
ejms07 is offline   Reply With Quote
Old March 18th, 2005   #2
deuce868
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
deuce868 is offline   Reply With Quote
Old March 18th, 2005   #3
ejms07
5 Cups of Ubuntu
 
ejms07's Avatar
 
Join Date: Mar 2005
Location: Puerto Rico
Beans: 33
Ubuntu 8.04 Hardy Heron
Send a message via ICQ to ejms07 Send a message via AIM to ejms07 Send a message via MSN to ejms07 Send a message via Yahoo to ejms07
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"
ejms07 is offline   Reply With Quote
Old March 18th, 2005   #4
alastair
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
alastair is offline   Reply With Quote
Old December 20th, 2005   #5
jbharrison
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 "$@"
Attached Files
File Type: txt rc-config.txt (2.8 KB, 207 views)

Last edited by jbharrison; January 9th, 2006 at 06:27 PM..
jbharrison is offline   Reply With Quote
Old December 22nd, 2005   #6
xtacocorex
Skinny Soy Caramel Ubuntu
 
xtacocorex's Avatar
 
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!
xtacocorex is offline   Reply With Quote
Old June 26th, 2006   #7
SRu
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( or rcconf(.

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(.
SRu is offline   Reply With Quote
Old August 4th, 2006   #8
tnilsson
Ubuntu Espresso Roast
 
tnilsson's Avatar
 
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!
tnilsson is offline   Reply With Quote
Old December 12th, 2006   #9
leftcase
Just Give Me the Beans!
 
leftcase's Avatar
 
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
I found this whilst looking for a solution myself - It's a debian solution which works...
__________________
Ubuntu UK | My Blog | Ubuntu UK Forum
leftcase is offline   Reply With Quote
Old December 12th, 2006   #10
technodigifreak
A Carafe of Ubuntu
 
Join Date: Jul 2006
Beans: 90
Re: chkconfig in Ubuntu?

Quote:
Originally Posted by SRu View Post
There is an alternative for editing runlevels that can be used just like chkconfig:
http://sysv-rc-conf.sourceforge.net/
.... The syntax is borrowed from chkconfig(.
Quote:
Originally Posted by leftcase View Post
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
I found this whilst looking for a solution myself - It's a debian solution which works...
I'll check both of them out. chkconfig was the only command that I was still missing from my days of using primarily redhat. If this works the way I remember it you'll both have made my week!

btw, apt is the reason I switched to Debian. apt > yum
technodigifreak is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:31 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry