Saturday, March 25, 2017

Service in Ubuntu

What is service utility in ubuntu?
"service" command is the preferred way utility to start, stop, list all services. to see all running services we can do the following
"sudo service --status-all".

How do I start/stop a service
To start a service - sudo service <service-name> start
To stop a service - sudo service <service-name> stop

How do I chaeck the status of a service
sudo service <service-name> status.
This command will give you a whole raft of information.  This detailed information includes location where service is installed, its status, how long has it been running, commands that are a part of the service, their location information, log locations and top 10 lines of the logs.

List of operations that are possible on a service include the following
start, stop, restart, force-reload, status.

Why should I know so much about Services
As a developers there are numerous occasions where you'll need to start/stop/re-start your application server. Gone are the days where services are installed in init.d directory locations. Also when you are done, you may want to stop the service. You may not want services like mysql, apache, wordpress, jenkins running all the time in your box, unless you need them. Here's where some information on service helps.

What about my snappy Wifi
And now to one of the most common problem in LINUX. If you have not installed the right drivers, for your Wifi connections, chances are your wifi connection is snappy at best. Only way you can resolve connection issue in the past is to re-start your box. Not anymore. You can solve this by restarting the network-manager service.

Here's the command
"sudo service network-manager restart"

What about snappy audio?
There are times when audio would not work, expecially when you connect to external audio devices and disconnect them. Easiest way to rid this issue is re-start pulse audio service

pulseaudio -k && sudo alsa force-reload

Next time your connection goes off, no sweat, you should be able to fix it in a second with the above command.