Re: trying to use nmcli under cron job question



On Thu, 2015-12-17 at 17:25 -0800, logical american wrote:
To all:

In regard to my questions on using nmcli under cron, some more 
experimentation and logging has shown that storing the password
globally 
is not pertinent to my issue, something else is occurring which I do
not 
understand yet, perhaps a GNOME policy setting.

I'm not sure about this, but when you invoke nmcli via a cron job, the
process usually has no session. Invoking most D-Bus calls are guarded
by PolicyKit, which might (depending on your configuration) reject a
call if the user has no session.

Anyway, in that case you should also see a proper AccessDenied failure
reason.


I have been carefully monitoring the D-Bus messages under normal CLI 
terminal activation, and it seems that I am going to have to
construct 
some type of D-Bus script to send the correct activation message to
the 
ethernet port, while running under cron.

nmcli and other clients use only D-Bus. Obviously you can
replace/reimplement every client by using D-Bus directly.

See here for examples how to do that: http://cgit.freedesktop.org/Netwo
rkManager/NetworkManager/tree/examples/python/dbus

(but usually you don't need to do that... nmcli should suit your need!)


I am using openSuse 13.2 and Network manager is 0.9.10.0-3.17.1 and
the 
native nm-connection-editor does NOT display any password icon or
allow 
the opportunity to specify the password globally, but I think this is
a 
diversion to the real issue here (but I could be wrong)

Yes. 0.9.10 connection-editor might look different. Look at the
connection:

  $ nmcli connection show $CONNECTION_ID

if the corresponding field SOME-PASSWORD-flags=0, then it means the
password is stored globally.
-- still, if there is no global password set or if authentication
fails, NM will again ask a secret agent to provided a correct (global)
password. So, at least initially you need a client capable of providing
the password.

The password should then also be stored in the corresponding file in
/etc/NetworkManager/system-connections/.




The captured D-Bus message to activate the IPV4 port eth0 is 1061
lines, 
I am very reluctant to post that message to this group.

Can I use this message to construct my own D-Bus message to wake up
and 
activate the IPV4 port?

as said: yes. But you should not be required to do so.
Also, nmcli uses libnm as D-Bus wrapper. libnm loads all properties
first, so you see much more D-Bus messages that are strictly necessary
for your case. Look at the examples [1] and the D-Bus API
( https://developer.gnome.org/NetworkManager/0.9/ )

 
what is the output of the cron job? What does nmcli print and which
commands are you invoking?



Thomas

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]