Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. /etc/systemd/system/
  2.  
  3. [Unit]
  4. Description=executed at shutdown
  5. Conflicts=reboot.target
  6. After=network.target
  7.  
  8. [Service]
  9. Type=oneshot
  10. ExecStart=/bin/true
  11. ExecStop=/path/to/script
  12. RemainAfterExit=yes
  13.  
  14. [Install]
  15. WantedBy=multi-user.target
  16.  
  17. #!/bin/sh
  18. echo 'the script is executed' > test.txt
  19.  
  20. bash test_script.sh
  21.  
  22. [Unit]
  23. Description=runs only upon shutdown
  24. Conflicts=reboot.target
  25. After=network.target
  26.  
  27. [Service]
  28. Type=oneshot
  29. ExecStart=/bin/true
  30. ExecStop=[whatever you need to run]
  31. RemainAfterExit=yes
  32.  
  33. [Install]
  34. WantedBy=multi-user.target
  35.  
  36. [Service]
  37. User=osmc
  38. ExecStart=/bin/true
  39. ExecStop=/path/to/script
  40. RemainAfterExit=yes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement