S50target 549 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. #
  3. # Restore / clear the Linux "SCSI target" driver configuration with `targetctl`
  4. #
  5. start() {
  6. local ret
  7. printf "Restoring target configuration: "
  8. /usr/bin/targetctl restore >/dev/null 2>&1
  9. ret=$?
  10. echo "done"
  11. return $ret
  12. }
  13. stop() {
  14. local ret
  15. printf "Clearing target configuration: "
  16. /usr/bin/targetctl clear >/dev/null 2>&1
  17. ret=$?
  18. echo "done"
  19. return $ret
  20. }
  21. restart() {
  22. stop
  23. start
  24. }
  25. case "$1" in
  26. start)
  27. start
  28. ;;
  29. stop)
  30. stop
  31. ;;
  32. restart)
  33. restart
  34. ;;
  35. *)
  36. echo "Usage: $0 {start|stop|restart}"
  37. exit 1
  38. esac