Python flask use buttons to trigger scripts
<p>I was investigating the web, mainly getting my self confused about several things.</p>

<p>First - what I need. my company runs java applications on our linux servers that non technological people uses. sometimes we have to restart those programs, but first kill them.</p>

<p>I've built small tool (runs on linux) that uses "jps -lm |grep -v Jps" to recover all java processes, then using splits and patterns to make something that looks like it:</p>

<pre><code>You have those programs running:
1. Java A
2. Java B
3. Java C
4. Exit
5. Refresh
</code></pre>

<p>They choose a number, It asks for approval, if allowed, kills the process ("kill procId") and restarts (while loop until they type 4 which triggeres "break").</p>

<p>Now, I wanted to take it to one level above, using web browser to minimize their appereance near my linux servers (sys admin).</p>

<p>Now, I've found that flask would be great for me, created a web page, even managed to make it available all over the web. </p>

<p>What I intend to do is that the value of my "jps -lm |grep -v Jps" would be inserted into the html file when someone reaches the webpage.
when the html is ready, they will be redirected to it, push the appropriate button, an "onclick=alert('are you sure?')" will pop up and if approved that will trigger a
"subprocess.Popen('kill '+procId, stdout.subprocess.PIPE, shell=True)" command that will kill the process, redirecting them to the page where my script maps the current running java that will redirect them to the buttons page.</p>

<p>I'm able to do everything except the buttons part. have no idea how to make it available to the python after pressed.</p>

<p>Would appriciate any help. for the mapping script I intended to use this solution: <a href="https://stackoverflow.com/questions/10903615/create-a-hyperlink-or-button-that-executes-a-python-script-and-then-redirects">Create a hyperlink (or button) that executes a python script and then redirects when script completes</a> .</p>

<p>sorry if my question is built badly, would appriciate any help with this as well!</p>

<p>Thanks! </p>