Environment=DISPLAY=:0
Thanks for that hint. Indeed that brings up the tray icon when Dropbox is started from systemd.
Excellent!
]]>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.
]]>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
[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
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.
]]>From what I remember dropbox will fail if it is started before you have a WiFi signal.
After=network.target
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.
]]>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.
]]>This was my solution.
~.xinitrc
# Start dropbox
sleep 45 && dropboxd &
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...
]]>dropboxd &
to .xinitrc? Is there some advantage to starting it via systemd?
]]>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?
]]>