Jump to content
14 minutes ago, Danielh90 said:

Yeah but I need to make sure that $1 will restart the service . 

$1 is just the first argument ... it doesn't do anything but pass a variable to your shell script. You mean you want to know how to make a script to restart services?

Link to comment
https://linustechtips.com/topic/794676-bash-script-restartsh/#findComment-10005153
Share on other sites

Link to post
Share on other sites

I need to do this restart.sh <servername> I run a MC Server and I would like to make it where I just have to do restart.sh all or <servername> and it will restart that I already have th code to make it restart it I just need the code to make the arg work

Link to comment
https://linustechtips.com/topic/794676-bash-script-restartsh/#findComment-10005163
Share on other sites

Link to post
Share on other sites

11 minutes ago, Danielh90 said:

I need to do this restart.sh <servername> I run a MC Server and I would like to make it where I just have to do restart.sh all or <servername> and it will restart that I already have th code to make it restart it I just need the code to make the arg work

In your 'restart.sh' script, you would just replace the static server name with the variable $1

 

Link to comment
https://linustechtips.com/topic/794676-bash-script-restartsh/#findComment-10005175
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×