Skip to content
Snippets Groups Projects
Commit 3f09652b753b authored by Lucas Li's avatar Lucas Li
Browse files

Add restart-except command to gitlab-ctl

- `restart-except` command is added
- maintenance docs are updated to reflect the change

Changelog: added
parent 1cbfe1b35331
No related branches found
No related tags found
1 merge request!146Merge upstream Omnibus GitLab into Omnibus Heptapod
......@@ -59,6 +59,9 @@
# Restart all GitLab components
sudo gitlab-ctl restart
# Restart all GitLab components except given services ... (e.g. gitaly, redis)
sudo gitlab-ctl restart-except gitaly redis
```
Note that on a single-core server it may take up to a minute to restart Puma and
......
#
# Copyright:: Copyright (c) 2014 GitLab B.V.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
add_command_under_category('restart-except',
'service-management',
'Restart all services except: service_name ...', 2) do |cmd_name|
args = ARGV.dup[3..]
if args.empty?
puts "Please provide services to exclude from restart"
exit 1
end
# get_all_services
services = get_all_services
# if provided service is not in the list of services, print error message
args.each do |service|
unless services.include?(service)
puts "Service '#{service}' not found"
exit 1
end
end
puts "Restarting all services except: #{args.join(', ')}."
exit_status = 0
# restart all services except the ones provided
services.each do |service|
exit_status += run_sv_command_for_service('restart', service) unless args.include?(service)
end
exit! exit_status
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment