1

I'm trying to run the command below on CentOS and of course I get command not found:

$ update-rc.d redis_6379 defaults

How do I then perform the equivalent using chkconfig?

1
  • update-rc.d doesn't not exist on Red Hat distros such as Fedora/CentOS/etc. The equivalent would be to use chkconfig, eg. chkconfig redis_6379 on or chkconfig --level 345 redis_6379 on.
    – slm
    Nov 11, 2014 at 3:10

2 Answers 2

2

final edit:

ok for the sake of closure (and being helpful) i'm updating this post with some notes. although the commands in this posts original form 'work', they seem to be, from my naive understanding, deprecated.

so as pointed out by @jayhendren, the replacement commands are:

~$ [sudo] systemctl enable redis_6379
~$ [sudo] systemctl start redis_6379

now, this may work for you without any further steps BUT if you're running SELinux and aren't paying attention, prepare yourself for a session of frustration (at least, if you're like me and always forget SELinux has a say in everything you do...).

anyway, for me, prior to getting those two commands working i executed:

~$ sudo setenforce 0 // turn off selinux
...
/* run the two commands */
/* i also added (maybe unnecessary): */
...
~$ sudo systemctl reload-daemon // akin to chkconfig --add i think
...
~$ sudo setenforce 1 // don't forget to fire'er back up again

**optional: verify selinux is doin' its thang**

~$ sudo getenforce // should return 'Enforcing' if run after the last step

hope this tip saves a future me from an hours worth of trouble.

ninja edit:

forgot the word on in the example command

original post:

@jordanm states two commands are needed but i can only find one in his reply (i am known to miss the obvious though)... anyway, i'm not sure if it was necessary but i also ran this command:

~$ [sudo] chkconfig --add redis_6379

after that, i ran the command in @jordanm's reply:

~$ [sudo] chkconfig redis_6379 on
~$ [sudo] service redis_6379 start

and all appears to be working thus far (centOS 7) ...

6
  • Use systemctl on CentOS 7.x instead of chkconfig and service. For instance: systemctl enable redis_6379; systemctl start redis_6379.
    – jayhendren
    Nov 15, 2016 at 0:31
  • oh neat, i did not know that -- thanks for the tip!may i prod for further information and ask specifically: why use one over the other?
    – mad.meesh
    Nov 15, 2016 at 0:33
  • systemd replaced sysVinit in EL7. Scripts called chkconfig and service are still available for compatibility's sake, but they're now just wrappers for systemd commmands.
    – jayhendren
    Nov 15, 2016 at 0:34
  • i see -- thanks, very informative for someone learning (like me)... a final request, if not too broad of a question, is there any online resource where i could read up on this specific topic further? not including wikipedia ...
    – mad.meesh
    Nov 15, 2016 at 0:38
1

It is important to understand what the command does in order to use the equivalent on a different system. Here is the description of "defaults" in the update-rc.d manpage:

   If  defaults is used then update-rc.d will make links to start the ser
   vice in runlevels 2345 and to stop the service in  runlevels  016.

In order to replicate this in chkconfig, two commands are needed:

chkconfig redis_6379 on

By default, chkconfig assumes levels 2345. Any runlevels not specified as on, will be marked as off. This will be levels 016.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.