Does Nginx, Mysql and php-fpm start automatically?

March 19, 2014 3k views
I followed every step in this tutorial till the last one:—SetUpAutostart When I tried to execute the commands I got an issue that "chkconfig is currently not installed". After installing it with "sudo apt-get install chkconfig" and executing the commands I get the following error message "Unknown option: levels". Are these commands necessary and if so, how do I execute them. One last information: I have created a user with root privileges (I followed this excellent tutorial:
2 Answers
The exact "Unknown option: levels" output leads me to believe one out of two possible scenarios:

1) You missed the -- before the "levels" option. That would completely invalidate the syntax.
2) You have mistyped the order of arguments for the command, since what usually happens is that we forget of those arguments along the way and then the chkconfig command just invalidates the whole line.

See examples:

sudo chkconfig --levels 235 mysqld on
sudo chkconfig --levels 235 nginx on
sudo chkconfig --levels 235 php-fpm on

From the tutorial you linked runs completely fine in my box.
But when I tried to issue a chkconfig command on my own (before looking at the tutorial.) I had typed:

chkconfig --levels 235 mysqld

Which brought me to:

"only one runlevel may be specified for a chkconfig query". Because I had forgotten to add the "on" argument at last. Remember:

chkconfig --levels

That should always be the syntax, in that order, or it will fail. Also, most linux/unix commands are case sensitive, in a way that "chkconfig --levels" and "chkconfig --LEVELS" might lead to two completely different outputs or expected behavior.
From your description I'm inclined to believe you forgot the -- suffix for the "levels" option, which is a must when arguments take more than one letter (i.e: "netstat -h" / "netstat --help" which would output exactly the same.).

Hope it helps! :)
Omg, I'm sorry, I totally overlooked the "CentOS 6" part, I have a LEMP environment setup on Ubuntu, no wonder this didn't work.

So sorry for wasting your time and thank you for your detailed explanation, hopefully this answer will help someone in the future.
Have another answer? Share your knowledge.