title: Bash script to kill process older than x time - syntax error in expression
body: <p>I'm trying to write a script to kill a process by ID if it is older than 5 minutes. I already know the process ID in <code>$pid</code>.</p>
  
  <pre><code>pid=1234
  
  # 300 seconds = 5min
  maximum_runtime=300
  
  process_start_time=`ps -o lstart= -p $pid`
  current_time=`date +%s`
  
  let diff=${current_time}-${process_start_time}
  
  if [ $diff -gt $maximum_runtime ]
  then
      kill -3 $pid
  fi
  </code></pre>
  
  <p>This results in an error:</p>
  
  <blockquote>
    <p>./script.sh: line 9: let: 11:41:01: syntax error in expression (error token is ":41:01")</p>
  </blockquote>
  
  <p>I used some code from <a href="https://serverfault.com/questions/181477/how-do-i-kill-processes-older-than-t/538446#538446">this answer</a>. Any ideas how to resolve this?</p>