title: Pam.exec exit code 8
body: <p>I'm trying to use <code>pam.d</code> to execute a script on user login. Right now I'm editing the <code>/etc/pam.d/su</code> file. Every time I log in to a user I get "Exit code 8".</p>
  
  <p>The command I use:</p>
  
  <pre><code>session optional pam_exec.so /etc/calendar/test
  </code></pre>
  
  <p>The path <code>/etc/calendar/test</code> is the path to the test script:</p>
  
  <pre><code>echo hi
  </code></pre>
  
  <p>Eventually I will implement a script that logs the user that logged in and what time:</p>
  
  <pre><code>user=$(whoami)
  date=$(date)
  echo $user logged in at $date &gt;&gt; /etc/calendar/tripwire_file
  </code></pre>
  
  <p>Any insight provided on this problem would be greatly appreciated.</p>