Is there a better way to write this?
Just some background:
I have tried using
Code: Select all
systemctl
Besides the developer of the application in question that uses this service(which is not a default service it comes from the app) says to use
Code: Select all
service xxx start or stop
Anyway the script runs fine has no errors and does what I want but there is always room to improve things.
Code: Select all
if [ "$EUID" -ne 0 ] #if user is not root
then #then use sudo
sudo service xxx stop;
sudo service xxx start;
else #if the user is root
service xxx stop; #just refresh the service
service xxx start;
fi
Code: Select all
service xx restart
Code: Select all
if
I want to put a check in their to see the service is running or not(which I have working I just didn't add it to this script yet)and an echo here and there to let the user know what is going on but I have been lazy about finishing it.
Any advice is appreciated.
Thanks.