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
?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI'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
?
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) ...
systemctl
on CentOS 7.x instead of chkconfig
and service
. For instance: systemctl enable redis_6379; systemctl start redis_6379
.
Nov 15, 2016 at 0:31
chkconfig
and service
are still available for compatibility's sake, but they're now just wrappers for systemd commmands.
Nov 15, 2016 at 0:34
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.
chkconfig
, eg.chkconfig redis_6379 on
orchkconfig --level 345 redis_6379 on
.