Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("top")
- modem.open(69)
- local dbbu = {}
- local function waitForBackup()
- while true do
- local _, side, freq, rfreq, database = os.pullEvent('modem_message')
- dbbu = database
- print("Database received from main database.")
- end
- end
- local function sendBackupBack()
- while true do
- local input = read()
- if input == "sendBackup" then
- modem.transmit(69, 69, dbbu)
- print("Backup send to main database.")
- elseif input == "getDatabase" then
- modem.transmit(69, 69, "askForDB")
- local _, side, freq, rfreq, database = os.pullEvent('modem_message')
- dbbu = database
- print("Database received from main database.")
- end
- end
- end
- parallel.waitForAll(waitForBackup, sendBackupBack)
- print("[EMERGENCY] BACKUP DATABASE OFFLINE.")
- modem.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement