Hi guys, I need some advice and recommendations for a work project I am doing. Let me state that security is not a concern as this is a closed network and the data is not sensitive.
Here's what I would like to do and how I was planning to accomplish it: I have an application on my remote servers that takes inputs and runs in the background with "&", it needs the kill command to terminate and generate its log file. Inputs are gathered from users on a web server and a shell script is created and SCPed to the remote servers, then the shell script is executed.
Within the shell script the command to run the application w/ its inputs is executed, next I capture the process ID...
myapplication -switches -filepath &
tempvar=&!
Next I need to set a cronjob to kill this process at a given time (also input by the users), so another file is created on the web server and SCPed, cronsetup.txt
in this file I have (for example user enters 5:30 am on September 23rd) :
30 5 23 9 * kill &tempvar
Now I was thinking to add this to my script so that when the initial script runs, it will set up the cron job, so....
myapplication -switches -filepath &
tempvar=&!
crontab cronsetup.txt
My question is, WILL THIS WORK???? is there an easier and quicker way to do all of this, am I just overdoing the process.
Recommendations please....