Advertisement
SouravGoswami1234

Untitled

Jul 14th, 2021
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. ######################### Ruby Script #########################
  2.  
  3. require 'fcntl'
  4.  
  5. begin
  6. fd = IO.sysopen('/dev/ttyUSB0', Fcntl::O_RDWR)
  7. sleep 0.01 while true
  8. rescue SignalException
  9. File.open('/tmp/x'.freeze, 'a').puts($!.full_message)
  10. sleep 0.01
  11. puts 'hi'
  12. retry
  13. rescue Exception
  14. retry
  15. end
  16.  
  17.  
  18. ######################### Systemd Service #########################
  19. [Unit]
  20. Description=Arduino OLED as a Ultra Light-Weight System Monitor
  21.  
  22. [Service]
  23. # ExecStart=/bin/ruby /root/.local/share/gem/ruby/3.0.0/bin/blink-tm
  24. ExecStart=/bin/ruby /tmp/p.rb
  25. Type=simple
  26. Restart=on-failure
  27. User=root
  28. Group=root
  29.  
  30. [Install]
  31. WantedBy=multi-user.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement