stop_service ()
{
sudo systemctl is-active --quiet video.service && sudo systemctl stop video.service && sudo rm /etc/systemd/system/video.service && echo stop video
sudo systemctl is-active --quiet audio.service && sudo systemctl stop audio.service && sudo rm /etc/systemd/system/audio.service && echo stop audio
sudo systemctl is-active --quiet stream.service && sudo systemctl stop stream.service && sudo rm /etc/systemd/system/stream.service && echo stop stream
sudo systemctl is-active --quiet images.service && sudo systemctl stop images.service && sudo rm /etc/systemd/system/images.service && echo stop images
sudo systemctl is-active --quiet browser.service && sudo systemctl stop browser.service && sudo rm /etc/systemd/system/browser.service && echo stop browser
sudo systemctl is-active --quiet youtube.service && sudo systemctl stop youtube.service && sudo rm /etc/systemd/system/youtube.service && echo stop youtube
}
I am using this function to check if any one of these 6 services is running. I stop it, remove it and echo which service was stopped. Looking at this function though, I feel like there's a better way of doing this instead of repeating the same line 6 times. But my shell knowledge is limited so hopefully someone more experienced than me can assist.
Thanks