title: How can I send stuff commands to a start-in-detached screen?
body: <p>Any session that I start with "-d -m" doesn't accept "-X stuff [...]" commands unless I've attached to the screen at least once.  There is no error message, the commands just do not get through.</p>
  
  <p>The problem is that I start the session from a cron job and am unable to attach to the screen from within cron.</p>
  
  <p><strong>Steps to repeat</strong></p>
  
  <pre><code>$ screen -m -d -S mydaemon bash
  $ screen -S mydaemon -X stuff "`printf "exit\\r"`"
  $ screen -ls
          32456.mydaemon  (Detached)
  $ screen -r -S mydaemon
  $ ^a d
  $ screen -S mydaemon -X stuff "`printf "exit\\r"`"
  $ screen -ls
  No Sockets found in /var/run/screen/S-user
  </code></pre>
  
  <p>^a d indicates pressing Ctrl+a then pressing d.</p>
  
  <p><strong>Versions</strong></p>
  
  <pre><code>CentOS release 5.5 (Final)
  Screen version 4.00.03 (FAU) 23-Oct-06
  </code></pre>