title: Run screen and command crontab
body: <p>I'm trying to add a new crontab that open a screen window and execute php command inside this window.</p>
  
  <p>What I'm trying:</p>
  
  <pre><code>sudo crontab -e
  10 0 * * * * screen -d -m php /var/www/script.php
  </code></pre>
  
  <p>This doesn't create a screen, but, if I remove after -m, creates normal.
  This code returns that I have to run on a terminal</p>
  
  <pre><code>10 0 * * * * screen -d
  </code></pre>
  
  <p>How can I do this?
  It's possible?</p>
  
  <p>Thanks.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Figured out. What I had to do is send some commands to attached screen, like this:</p>
  
  <pre><code>screen -S sessionname -X stuff 'command'`echo -ne '\015'`
  </code></pre>
  
  <p><code>echo -ne '\015'</code> emulates pressing the Enter key.</p>
  
  <p>It was mentioned here: <a href="https://superuser.com/a/274071">https://superuser.com/a/274071</a></p>