Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local file_path = "/path/to/your/file.txt" -- Replace this with your file's path
- local interval = 5 -- Adjust the interval in seconds
- local function checkFile()
- while true do
- if not fs.exists(file_path) then
- print("File not found. Running code...")
- -- Insert your code here to execute if the file is not found
- -- Example: shell.run("your_script")
- -- Replace "your_script" with the script or command you want to execute
- return -- Exit the function after running the code
- end
- os.startTimer(interval) -- Set the timer to check again after the interval
- os.pullEvent("timer") -- Wait for the timer event
- end
- end
- -- Start the background process
- parallel.waitForAny(checkFile, function() os.pullEvent("terminate") end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement