You are not logged in.

#1 2013-03-16 16:51:21

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

[solved] NetworkManager dispatcher script working manually, not autom.

[orschiro@thinkpad dispatcher.d]$ cat 10-dropbox 
#!/bin/bash
# /etc/NetworkManager/dispatcher.d/10-dropbox

case "$2" in
        up)
                      killall dropbox
                      su -c dropboxd orschiro
        ;;
        down)
        ;;
esac
-rwxr-xr-x 1 root root  163 16. Mär 17:41 10-dropbox

If I run this script manually, dropbox is killed, the tray icon disappears and comes up again.

If I run this script automatically as a dispatcher script executed by NetworkManager after a connection is up, the tray icon disappears but never comes up again.

What is the reason?

EDIT:

I just saw in the journal that the script seems to time out:

Mär 16 17:57:26 thinkpad NetworkManager[459]: <warn> Dispatcher script timed out: Script '/etc/NetworkManager/dispatcher.d/10-dropbox' timed out.

How can I increase the timeout?

Last edited by orschiro (2013-03-23 17:37:58)

Offline

#2 2013-03-16 20:12:11

aesiris
Member
Registered: 2012-02-25
Posts: 94

Re: [solved] NetworkManager dispatcher script working manually, not autom.

I don't know what is the reason for the beaviour you are seeing,
but I prefer to use the systemd service instead of calling dropboxd from the dispatcher:

case "$2" in
        up)
                      systemctl restart dropbox@orschiro
        ;;
        down)
                      systemctl stop dropbox@orschiro
        ;;
esac

Offline

#3 2013-03-16 20:17:14

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] NetworkManager dispatcher script working manually, not autom.

Thank you aesiris.

I did not know that dropbox has a systemd service. However, does starting the service bring up a tray icon on your system?

Here on Cinnamon it does not show a tray icon. Dropboxd (started manually) does.

Offline

#4 2013-03-16 20:34:01

aesiris
Member
Registered: 2012-02-25
Posts: 94

Re: [solved] NetworkManager dispatcher script working manually, not autom.

I do not know because I use only the CLI interface.

I guess the difference comes from $DISPLAY not being set.
See if you find any other difference in the ENV of dropbox:

tr "\000" "\n" < /proc/$(pidof dropboxd)/environ

Offline

#5 2013-03-17 06:30:46

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] NetworkManager dispatcher script working manually, not autom.

[orschiro@thinkpad ~]$ tr "\000" "\n" < /proc/$(pidof /opt/dropbox/dropbox)/environ
LC_MONETARY=de_DE.utf8
LC_NUMERIC=de_DE.utf8
USER=orschiro
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
LANG=en_US.utf8
LC_MEASUREMENT=de_DE.utf8
SHLVL=0
HOME=/home/orschiro
LOGNAME=orschiro
LC_TIME=de_DE.utf8

I had to change dropboxd to /opt/dropbox/dropbox for the pidof to work. What does that output say?

Offline

#6 2013-03-17 06:45:09

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] NetworkManager dispatcher script working manually, not autom.

The wiki provides the answer. According to that it is normal to not have a tray icon.\

Recent versions of Dropbox come with a systemd service file. Running Dropbox as a daemon does not give you an icon in the system tray, but syncs your files and folders in the background.

.

So I guess I will just stick to the service approach without the tray icon. At least this does its work and can be called from the dispatcher.

Offline

#7 2013-03-17 12:04:00

aesiris
Member
Registered: 2012-02-25
Posts: 94

Re: [solved] NetworkManager dispatcher script working manually, not autom.

orschiro wrote:
[orschiro@thinkpad ~]$ tr "\000" "\n" < /proc/$(pidof /opt/dropbox/dropbox)/environ
...

I had to change dropboxd to /opt/dropbox/dropbox for the pidof to work. What does that output say?

The output writes all the environment variables of that process (It's the same difference as when on the forum you are asked to post the output of  "LANG=C pacman -Qi pacman" instead of just "pacman -Qi pacman").

I think you posted the output relative to a dropbox process started from systemd, try it when it is started from your user shell and see the difference.

If (as I am guessing) the problem is only that DISPLAY is not set, you can teach systemd to set the correct value.
For example using the new (systemd 198) drop-in functionality you would do:

mkdir /etc/systemd/system/dropbox.service.d/
cat > /etc/systemd/system/dropbox.service.d/EnvDisplay0.conf <<EOF
[Service]
Environment=DISPLAY=:0
EOF

if you now start dropbox from systemd, you should find also "DISPLAY=:0" in the output from /proc/.../environ
I hope that this would be enought to make the icon appear.

Offline

#8 2013-03-23 17:37:30

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] NetworkManager dispatcher script working manually, not autom.

Thanks aesiris for the hint with the environment setting. I wondered that it is not used as default in the Dropbox service file. This brings up the tray icon correctly!

Offline

Board footer

Powered by FluxBB