Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local program=""
- local args={}
- local autoRestart=true
- -- Display ID
- shell.run("id")
- -- Find a modem (from GPS script)
- for n,side in ipairs(rs.getSides()) do
- if peripheral.getType(side) == "modem" then
- rednet.open(side)
- break
- end
- end
- -- Autorun program
- if program~=nil and program ~= "" then
- if term.isColor() then
- term.setTextColor(colors.yellow)
- write("> ")
- term.setTextColor(colors.white)
- else
- write("> ")
- end
- print(program.." "..table.concat(args," "))
- if not shell.run(program, unpack(args)) then
- if autoRestart then
- write("'"..program.."' crashed! Restarting in ")
- for i=5,1,-1 do
- write(i .. "...")
- sleep(1)
- local x, y = term.getCursorPos()
- term.setCursorPos(x-4, y)
- end
- term.clearLine()
- local x, y = term.getCursorPos()
- term.setCursorPos(1, y)
- os.reboot()
- else
- print("'"..program.."' crashed!")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement