Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # place in /etc/systemd/system/whatever.service and install with `systemd install whatever.service`
  2. # note that if you change this file you will need to run `systemctl daemon-reload` to get systemd to notice
  3. [Unit]
  4. Description=A good service description
  5.  
  6. # After networking because we need that
  7. After=network.target
  8.  
  9. [Service]
  10.  
  11. # Simple services don't do any forking / background nonsence
  12. Type=simple
  13.  
  14. # User with which to run the service
  15. User=pi
  16.  
  17. # Any setup we need to do, specifying the shell because otherwise who knows what's up
  18. ExecStartPre=/bin/bash -c 'echo "hello world"'
  19.  
  20. # Set the working directory for the application
  21. WorkingDirectory=/my_app/
  22.  
  23. # Command to run the application
  24. ExecStart=/my_app/my_app.bin
  25.  
  26. # Restart policy, only on failure
  27. Restart=on-failure
  28.  
  29. [Install]
  30. # Start the service before we get to multi-user mode
  31. WantedBy=multi-user.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement