title: How to set the program as daemon after $DISPLAY is set?
body: <p>I want to set my screen as screensave status every 50minutes (3000 seconds).</p>
  
  <pre><code>cat /home/rest.sh  
  while true;do
  sleep  3000
  xscreensaver-command --lock  1&gt;/dev/null
  done 
  </code></pre>
  
  <p><code>sh /home/rest.sh &amp;</code> can make it run.<br>
  Now i want to set it as a daemon.  </p>
  
  <pre><code>sudo vim  /etc/systemd/system/screensave.service
  [Unit]
  Description=screensave 
  
  [Service]
  User=root
  ExecStart=/bin/bash /home/rest.sh  
  StandardError=journal
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  
  <p>To set it and enable as daemon.   </p>
  
  <pre><code>systemctl enable screensave.service
  </code></pre>
  
  <p>I find that the service is not running as a daemon.</p>
  
  <pre><code>sudo journalctl -u  screensave
  Jan 24 12:16:50 user systemd[1]: Started screensave.
  Jan 24 12:17:22 user bash[621]: xscreensaver-command: warning: $DISPLAY is not set: defaulting to ":0.0".
  Jan 24 12:17:22 user bash[621]: No protocol specified
  Jan 24 12:17:22 user bash[621]: xscreensaver-command: can't open display :0.0
  </code></pre>
  
  <p>How to run it as a daemon after $DISPLAY is set ? </p>