Reputation: 105
im want to use lua to reset one of the openwrt`s Linux services . when i use below command in Linux directly and it works :
$ service
it shows below services when i type below command it shows me more options :
$ service led
finally when i type below command it resets the service .
$ service led restart
but with lua`s below program i got error .
>os.execute("service led restart")
sh: service: not found
is there any other library or command to access services ?
Upvotes: 1
Views: 495
Reputation: 23727
command -V service
says:
service is a function
To be able to invoke it in a subshell created by os.execute
you have to source
the script which creates the function. (I don't know where this function was defined).
The more easy way is to invoke the specific service executable:
os.execute"/etc/init.d/led restart"
Upvotes: 1