I'm writing a very simple script to control a process, script checks if the process is running, if not: executes it.
I need to expand this with the ability to kill a specific process instance (very one one script has started) after a specified amount of time. Problem is, once bash script is executed it isn't running until the executed program finishes.Ability to pass some input to the process would also be useful, as I have a graceful exit function built in to the service I'm running.
Basically, my bash script should run along the process it's started, and send a kill command via stdin after sleep x times out.
How do I forward some scripted input to the process script has started, and how do I keep the script running after executing the process?
Thanks in advance.