05.04.2023, 19:09
Hello Daniel.
Is it possible to create a script for reboot the LM?
Is it possible to create a script for reboot the LM?
Script for Reboot
|
05.04.2023, 19:09
Hello Daniel.
Is it possible to create a script for reboot the LM?
05.04.2023, 19:38
Try this:
Code: 1 os.execute('reboot')
06.04.2023, 07:09
Be careful with this, if you loop controller in constant reboot, the only way out is hardware factory reset.
------------------------------
Ctrl+F5
06.04.2023, 14:52
08.04.2023, 13:58
Is it also possible to get a notification when it restarts?
(08.04.2023, 13:58)Dré Wrote: Is it also possible to get a notification when it restarts? Code: 123456789101112131415161718192021222324252627282930313233343536373839404142434445 -- Common Function
function mail(to, subject, message)
-- make sure these settings are correct
local settings = {
-- "from" field, only e-mail must be specified here
from = 'servis@servis.com',
-- smtp username
user = 'username',
-- smtp password
password = 'password',
-- smtp server
server = 'smtp.myserver.com',
-- smtp server port
port = 25,
-- enable ssl, required for gmail smtp
-- secure = 'sslv23',
}
-- port 465
local smtp = require('socket.smtp')
if type(to) ~= 'table' then
to = { to }
end
for index, email in ipairs(to) do
to[ index ] = '<' .. tostring(email) .. '>'
end
-- message headers and body
settings.source = smtp.message({
headers = {
to = table.concat(to, ', '),
subject = subject,
['Content-type'] = 'text/html; charset=utf-8',
},
body = message
})
-- fixup from field
settings.from = '<' .. tostring(settings.from) .. '>'
settings.rcpt = to
return smtp.send(settings)
endCode: 12 -- Init Script
mail( 'mymail@mail.com', 'Restart LogicMachine', 'my message body')Code: 12 -- Sync before reboot
os.execute('sync')
11.04.2023, 05:51
You can add a notification to the init script. A short delay might be needed as internet connection might not be ready when the script starts.
As for reboot via a script it should not be needed at all. If you are experiencing a bug that requires rebooting LM to fix it then let us know and we will look into it.
09.08.2023, 15:19
|
« Next Oldest | Next Newest »
|