You are not logged in.

#1 2013-03-18 05:00:34

aragorn22
Member
Registered: 2013-03-18
Posts: 5

Dropbox on awesome

Can not properly configure the autostart of dropbox. I have arch + awesome, wifi via netcfg and dropbox 2.0.0-1 from AUR.

1) On dropbox preferences checked "start dropbox on system start" (has ~/.config/autostart/dropbox.desktop)
2) Dropbox start as service via systemctl. After boot

[gena@x230 ~]$ systemctl status dropbox\@gena
dropbox@gena.service - Dropbox
	  Loaded: loaded (/usr/lib/systemd/system/dropbox@.service; enabled)
	  Active: active (running) since Fri 2013-03-15 21:41:20 MSK; 10min ago
	Main PID: 624 (dropbox)
	  CGroup: name=systemd:/system/dropbox@.service/gena
		  └─624 /opt/dropbox/dropbox

3) htop says that dropbox work
4) I add to /etc/systemd/system/multi-user.target.wants/@dropbox@gena.service (symlink to /usr/lib/systemd/system/dropbox@.service) in service section

Environment=DISPLAY=:0

https://bbs.archlinux.org/viewtopic.php?id=157629

My files don't synchronized (i.e. dropbox don't work), icon on awesome tray is not displayed.
I tried to customize the interface (/etc/network.d/interfaces/wlp3s0)

POST_UP="su -c 'DISPLAY=:0 /usr/bin/dropboxd &' gena"
PRE_DOWN="killall dropbox"

but it did not help.

If i do after boot

sudo systemctl stop dropbox\@gena
sudo systemctl start dropbox\@gena

than dropbox work correctly. Where i am wrong?

Last edited by aragorn22 (2013-03-18 05:02:30)

Offline

#2 2013-03-18 06:06:19

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: Dropbox on awesome

if you're using awesome, why not just add

dropboxd &

to .xinitrc? Is there some advantage to starting it via systemd?

Offline

#3 2013-03-18 06:17:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Dropbox on awesome

cris9288 wrote:

if you're using awesome, why not just add

dropboxd &

to .xinitrc? Is there some advantage to starting it via systemd?


It doesn't try to start another instance when you restart X...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2013-03-18 06:19:56

aragorn22
Member
Registered: 2013-03-18
Posts: 5

Re: Dropbox on awesome

I'm sorry, I did not say that I sometimes do not run X (for example, when I turn laptop to send data via ftp). So I would like to work with dropbox with and without awesome.

Last edited by aragorn22 (2013-03-18 06:42:04)

Offline

#5 2013-03-18 13:54:08

doug piston
Member
From: Seattle
Registered: 2011-09-11
Posts: 387
Website

Re: Dropbox on awesome

From what I remember dropbox will fail if it is started before you have a WiFi signal.

This was my solution.
~.xinitrc

# Start dropbox
sleep 45 && dropboxd &

Offline

#6 2013-03-18 14:07:00

xacobe97
Member
From: Galicia, Spain
Registered: 2013-03-17
Posts: 5

Re: Dropbox on awesome

doug piston wrote:

From what I remember dropbox will fail if it is started before you have a WiFi signal.

This was my solution.
~.xinitrc

# Start dropbox
sleep 45 && dropboxd &

He said he wants to use dropbox even in tty, so that solution isn't valid.

Offline

#7 2013-03-18 15:14:30

doug piston
Member
From: Seattle
Registered: 2011-09-11
Posts: 387
Website

Re: Dropbox on awesome

xacobe97 wrote:

He said he wants to use dropbox even in tty, so that solution isn't valid.

Apologies. That's what I get for posting at 6am.

Offline

#8 2013-03-18 15:47:11

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: Dropbox on awesome

Is something like the 'sleep 45' suggestion possible for the systemd service the op has set up?  I ask because I'm not that familiar with creating/modifying systemd services.


I laugh, yet the joke is on me

Offline

#9 2013-03-18 15:54:18

gridcol
Member
From: Karlsruhe, Germany
Registered: 2012-03-27
Posts: 32

Re: Dropbox on awesome

doug piston wrote:

From what I remember dropbox will fail if it is started before you have a WiFi signal.

After=network.target

- https://bbs.archlinux.org/viewtopic.php?id=158722

Last edited by gridcol (2013-03-18 15:56:55)

Offline

#10 2013-03-18 19:39:11

xacobe97
Member
From: Galicia, Spain
Registered: 2013-03-17
Posts: 5

Re: Dropbox on awesome

doug piston wrote:
xacobe97 wrote:

He said he wants to use dropbox even in tty, so that solution isn't valid.

Apologies. That's what I get for posting at 6am.

Don't worry man, i'm not a human being before 1 pm. That's why i fail at school. Also sorry, i think my previous answer sounded unfriendly.

Last edited by xacobe97 (2013-03-18 20:00:39)

Offline

#11 2013-03-19 04:01:03

aragorn22
Member
Registered: 2013-03-18
Posts: 5

Re: Dropbox on awesome

Ok, thanks to all.
My service file:

[Unit]
Description=Dropbox
After=local-fs.target network.target

[Service]
Environment=DISPLAY=:0
Type=simple
ExecStart=/usr/bin/dropboxd
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
User=%I

[Install]
WantedBy=multi-user.target

If I understand, I need to enable the service NetworkManager-wait-online?
But when I do it, I get

[gena@x230 ~]$ sudo systemctl enable NetworkManager-wait-online.service
[sudo] password for root: 
Failed to issue method call: No such file or directory

Offline

#12 2013-03-19 06:03:15

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Dropbox on awesome

I use a standard servcice file, but this hack on the dropbox page:
https://wiki.archlinux.org/index.php/Dropbox#Connecting...

with a slightly different network test; that way it only starts once I have an established network connection:

#!/bin/sh

# Copyright 2008 Evenflow, Inc., 2010 Dropbox
#
# Environment script for the dropbox executable.

start_dropbox() {
PAR=$(dirname $(readlink -f $0))
OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
LD_LIBRARY_PATH=$PAR:$LD_LIBRARY_PATH 

TMP1=$(ps -C dropbox -opid=)
if [ -n "$TMP1" ]; then
  kill -9 "$TMP1" >/dev/null 2>&1
fi
exec $PAR/dropbox $@ &
}

do_dropbox() {
start_dropbox >/dev/null 2>&1
while [ 1 ]; do
  sleep 5
  ERROR="$(net_test)"
  if [ -n "$ERROR" ]; then
    LAST_ERROR=1
  else
    if [ -n "$LAST_ERROR" ]; then
      # Connection seems to be up but last cycle was down
      LAST_ERROR=""
      start_dropbox >/dev/null 2>&1
    fi
  fi
done

}

net_test() {
    netup="$(ping -qc 3 google.com 2>/dev/null)"
[ -z "$netup" ] && echo "error"
}

do_dropbox

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#13 2013-03-19 07:25:57

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: Dropbox on awesome

I use netctl's (formally netcfg) ExecUpPost to run a script which sets up my proxy settings and runs wget to obtain my external IP address and save it into /home/conf/my_ip

I also run an inotifywait on /home/conf/my_ip which starts dropbox (and offlineimap) when my_ip contains a value and kills them when my_ip is blank (its cleared by netctl as well).

Sounds like something I could handle with systemd, now that I think about it, but its worked well for me for years.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#14 2013-03-19 13:47:27

aragorn22
Member
Registered: 2013-03-18
Posts: 5

Re: Dropbox on awesome

I change /opt/dropbox/dropboxd content as jasonwryan variant. Now when I start awesome dropbox work. But when I restart awesome sometimes (or maybe always) dropbox can not work and icon always not displayed.

Last edited by aragorn22 (2013-03-19 14:19:07)

Offline

#15 2013-03-23 17:24:14

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

Re: Dropbox on awesome

Environment=DISPLAY=:0

Thanks for that hint. Indeed that brings up the tray icon when Dropbox is started from systemd.

Excellent!

Offline

Board footer

Powered by FluxBB