init:stop() seems to stop the local node, not the remote node.
> In production, we do it like this: `+Bi -stdlib restricted_shell
> shell_restriction_policy_mod'
Nice advice.
--
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu
Are you sure? Depends on what you define as remote and local.
Everything you write is executed on the remote node which is
local from the point of view of the (remote) shell.
The way I think it works is that `remsh' creates just a new
shell on the remote node which is redirected to another
console, and should deliver the very same behaviour as if
you're directly on the remote machine's console and start
another shell job via ^G followed by `s' command.
At the other hand, if you make ^G and `s' on the "local"
node (that one which was started with -remsh), you can
get shell which is truly local to that secondary node.
If you know about any tricks how to detect the original
node which is just remsh'd somewhere, let me know, because
it may be useful for improving the restricted_shell module.
[I would like to have ability to issue `q().' only on
the master console and block it on all the others.
Now we have it that `q().' is disabled at all unless
you issue something like `shell_restriction_policy:unlock ()'
and then the `q()' becomes allowed.]
A little example at the end:
tmr@gersemi:~$ erl -sname foo -setcookie abc
Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9 (abort with ^G)
(foo@gersemi)1>
(foo@gersemi)1>
(foo@gersemi)1> node ().
foo@gersemi
(foo@gersemi)2>
tmr@gersemi:~$ erl -sname boo -setcookie abc -remsh foo@gersemi
Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9 (abort with ^G)
(foo@gersemi)1>
(foo@gersemi)1> node ().
foo@gersemi
(foo@gersemi)2>
User switch command
--> j
1* {foo@gersemi,shell,start,[]}
--> s
--> j
1 {foo@gersemi,shell,start,[]}
2* {shell,start,[]}
--> c 2
Eshell V5.9 (abort with ^G)
(boo@gersemi)1>
User switch command
--> c 1
(foo@gersemi)2>
No, you are right, I got confused by what happens when you use -eval at
the same time (which is ran locally). That explains it.
--
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu