Hi I'm working on a script to manage some stuff on my server and I'm trying to figure out how I can close my script when I'm done with it. I open it using &, but how can I kill it with another script? I'm trying to do this programmatically but I'm very unfamiliar with Linux.
I'm not really sure what you're asking. A properly written script should end on its own when it is done executing.
If I understand correctly you have a script that you run in the background using & and you would like to kill it after a while. Also hopefully this script is supposed to be running for a while.
You can find the process id of you script by using a command such as:
replace test.sh by the name of your script
to kill it run
ps is the command to list the processes on the computer, aux says print every process on the system, grep search for a string from standard input (the output of ps in this case), awk is a program that allows you to process some text and run stuff on it. In this case I asked it to print the second column of the ouput of the first two commands.