I do not know the service\'s name, but would like to stop the service by checking its status.
For example, if I want to check if the PostgreSQL service is running or no
For Ubuntu (checked with 12.04)
You can get list of all services and select by color one of them with 'grep':
sudo service --status-all | grep postgres
Or you may use another way if you know correct name of service:
sudo service postgresql status