The Computer Oracle

CentOS7: Restart multiple instances of a service with one command

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Lost Jungle Looping

--

Chapters
00:00 Centos7: Restart Multiple Instances Of A Service With One Command
00:24 Accepted Answer Score 30
01:05 Thank you

--

Full question
https://superuser.com/questions/958148/c...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#systemd #centos7

#avk47



ACCEPTED ANSWER

Score 30


You should be able to restart both of them with one systemctl, just put a space between the services. E.g. systemctl restart thingd@01 thingd@02

I usually stop all major services before cloning an instance after it has been removed from a load balanced pool. I use the following:

# stop php-fpm, MariaDB, nginx and postfix

systemctl stop php-fpm nginx postfix mariadb

# check status after they have been stopped

systemctl status php-fpm nginx postfix mariadb

# start all of them again

systemctl start php-fpm nginx postfix mariadb