User input during a systemctl/service call for CentOS?
<p>Lets say I have a service (like rsyslog) that when I stop it, I want to log the reasoning behind someone shutting it down. Expressing this simply would be</p>

<pre><code>systemctl start rsyslog
systemctl stop rsyslog
</code></pre>

<p>(Begin the prompt as to why a user is doing this after shutting down rsyslog)</p>

<pre><code>#!/bin/bash
    echo "you are shutting down the syslog service. Please state your name and reason."
    read -p "[name?]" name &amp;&amp; read -p "[reason?]" reason 
    logger $name:$reason
</code></pre>

<p><a href="https://www.freedesktop.org/software/systemd/man/systemd.service.html#" rel="nofollow noreferrer">Modifying the Unit Files</a> (located in /usr/lib/systemd/system/rsyslog.service), to include an ExecStop of the path to the script, I am able to run the above script. I know that the script is working as checking the log messages shows a <code>:</code>, the nonvariable portion that was passed to logger.</p>

<p>I need to be able to have this script operate like said shell script <strong>the instant</strong> someone attempts to shutdown the logging service. This means that echo commands are shown on the terminal and variables can be recorded using the read command.</p>

<p><a href="https://stackoverflow.com/questions/35042913/user-input-is-not-promted-in-centos7-using-systemctl-or-service-command/35123733#35123733">This may be similar to this persons question, but I can not understand it.</a> </p>