Posts: 264
Threads: 39
Joined: Feb 2016
Reputation:
1
Hello, is it possible to have the hostname of the lmachine by script
something like
myname= hostname
-----------
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT
Posts: 264
Threads: 39
Joined: Feb 2016
Reputation:
1
(24.08.2017, 17:37)admin Wrote: Code:
hostname = io.readfile('/proc/sys/kernel/hostname'):trim()
-----------
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT
Posts: 12
Threads: 2
Joined: Oct 2017
Reputation:
0
hi, how can i write a hostname by script?
io.writefile...
Posts: 4661
Threads: 24
Joined: Aug 2017
Reputation:
212
Try this
Code:
------------------------------------
require('uci')
uci.set("system.@system[0].hostname=name63characters")
uci.commit('system')
--------------------------------------
------------------------------
Ctrl+F5
Posts: 4661
Threads: 24
Joined: Aug 2017
Reputation:
212
I tried it and it worked. Your browser cache?
------------------------------
Ctrl+F5