You started out fine, however you're creating a timer that fires an event when it reaches completion.
Spoiler
rs.setOutput("right",true) --# You already know this turns on the redstone
print("Buenos Dias") --# You already know this prints to the screen
local p = os.startTimer(3) --# This is a local variable, basically you''re setting 'p' to equal the value of os.startTimer(3) so that you can refer to it later.
while true do --# this will repeat everything below it until the end, represented by the end that you will see below it.
local event, timerID = os.pullEvent("timer") --# This looks for an event to happen, and with the string "timer" its looking for a timer event only
if timerID == p then --# compares the timer that it found and sees if its the same as the timer you started earlier
rs.setOutput("right",false) --# turns off the redstone
break --# gets you out of the while true do loop, if you didnt have this it would go right back up to the local event, timerID line
end --# You need ends after every while loop, if statement, and basically most things, if you ever get an <eof> error, you have too many
end
local k = os.startTimer(480) --# starts a new timer with 480 seconds linked to the variable k. This happens AFTER the initial timer p happens earlier
while true do --# another while true do loop, this is an infinite loop which will keep going until you leave it using break
local event, param1 = os.pullEvent("timer") --# another event, in this case param1 is the same as timerID, i just changed the name. You can set it to pizza and it will work
if param1 == k then --# same as before. if you do change it to pizza, you have to change the param1 here to pizza as well :P/>/>/>/>/>/>
os.reboot() --# restarts the computer
end
end
Now there probably is a way to compact this code, however for the beginning it's quite fine, although i'm confused as to the purpose.
EDIT: Okay i overcomplicated it, an easier code, as Kouksi44 pointed out is that you're just waiting, so you just need a sleep()
rs.setOutput("right",true)
print("Buenos Dias")
sleep(3) --# just waits for 3 seconds
rs.setOutput("right",false)
sleep(480)
os.reboot()