Restarting dropbox-daemon if running
Try
killall dropbox
This is going to stop it for sure! By default SIGTERM is sent, which is a right way to stop a process. If your system supports multiple simultaneous user logins, then this command is going to terminate dropbox for all users, or at least it will attempt to do so. So more elegant way is to use
killall -u myusername dropbox
and if you're currently logged in by that user:
killall -u "$(whoami)" dropbox
Or maybe even
killall -u "$USER" dropbox
Update: well, it seems like people like this answer. However, there is one important thing to know. Just sending a signal to a process does not really mean that it will terminate immediately (or that killall is going to wait for it to terminate). So it is possible that dropbox will attempt to terminate safely (which could take some time to finish) when you assume that it is already gone. Just a thing to consider.
Admin
Updated on June 30, 2022Comments
-
Admin almost 2 years
I have a couple of encrypted drives that I mount manually with a script after start. One of those drives hosts my dropbox folder.
I need to check if dropbox is running when mounting the drive so that I can stop dropbox and then start it again so it syncs correctly.
This is what I have so far, but I can't get it to stop dropbox if it's already running.
#!/bash/rc if ~/dropbox.py running && [ $? -eq 1 ]; then ~/dropbox.py stop else ~/dropbox.py start fi