LolzPB

systemd

May 21st, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. ftr = {}
  2. functr = {}
  3.  
  4. os.loadAPI("/lib/thread")
  5.  
  6. for i, k in pairs(fs.list("/etc/systemd")) do
  7. file = fs.open("/etc/systemd/"..k, "r")
  8. if file.readLine() == "[STARTUP]" then
  9. ftr[k] = file.readLine()
  10. file.close()
  11. end
  12. end
  13.  
  14.  
  15. for i, k in pairs(ftr) do
  16. thr = thread.create(k)
  17. if not coroutine.status(thr) == "dead" then
  18. term.write("[")
  19. term.setTextColor(colors.lime)
  20. term.write("OK")
  21. term.setTextColor(colors.white)
  22. term.write("] ")
  23. term.write("Avviato "..i.." da "..k)
  24. else
  25. term.write("[")
  26. term.setTextColor(colors.red)
  27. term.write("FAIL")
  28. term.setTextColor(colors.white)
  29. term.write("] ")
  30. term.write("Avvio non riuscito di "..i.." da "..k)
  31. end
  32. end
  33.  
  34. sleep(1)
  35. term.clear()
  36. term.setCursorPos(1, 1)
  37. shell.run("/bin/bash")
Advertisement
Add Comment
Please, Sign In to add comment