title: Systemd service fails with status=203/EXEC although shebang is in sh file
body: <p>I have a short bash script that I want to automatically start when my Raspberry Pi boots up. Using systemd, I've been trying to test the service file manually but it always enters a fail state, not sure what I'm doing wrong.</p>
  
  <p>I've Googled around and most people say they solved their problem by adding 
  <code>#!/bin/bash</code> to the top of their .sh file, or adding that path to the service file (i.e. <code>ExecStart=/bin/bash file_to_execute.service</code>). I've tried both of these and I'm still running into errors.</p>
  
  <p>Here is my .sh file, I've confirmed that it works when I manually run it:</p>
  
  <pre><code>#!/bin/bash
  
  sudo mining/2pac/cgminer/cgminer --default-config mining/2pac/cgminer/cgminer.conf &amp;
  
  sudo python3 mining/2pac/cgminer/BTCLotto-master/btclotto.py
  </code></pre>
  
  <p>Here is the service file: </p>
  
  <pre><code>[Unit]
  Description=BTC Lotto Miner
  After=network.target network-online.target
  Wants=network-online.target
  
  [Service]
  ExecStart=/mining/2pac/cgminer/lottominer.sh
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  
  <p>With these files, these are the errors I get when I run the service with     <code>sudo systemctl start lottominer.service</code>:</p>
  
  <pre><code>lottominer.service - BTC Lotto Miner
     Loaded: loaded (/lib/systemd/system/lottominer.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2019-07-24 16:47:05 UTC; 2s ago
    Process: 2324 ExecStart=/mining/2pac/cgminer/lottominer.sh (code=exited, status=203/EXEC)
   Main PID: 2324 (code=exited, status=203/EXEC)
  
  Jul 24 16:47:05 raspberrypi systemd[1]: Started BTC Lotto Miner.
  Jul 24 16:47:05 raspberrypi systemd[1]: lottominer.service: Main process exited, code=exited, status=203/EXEC
  Jul 24 16:47:05 raspberrypi systemd[1]: lottominer.service: Unit entered failed state.
  Jul 24 16:47:05 raspberrypi systemd[1]: lottominer.service: Failed with result 'exit-code'.
  </code></pre>
  
  <p>When I edit the service file to <code>ExecStart=/bin/bash /mining/2pac/cgminer/lottominer.sh</code> and also maintain the shebang in the .sh file, I get the same errors but the error changes to <code>(code=exited, status=127)</code></p>
  
  <p>Any help is appreciated, I've been reading forums for a long time with no answers...</p>