Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed the dropbox using the text based install method described here. However I'd now like dropbox to start automatically when the machine starts up, and start syncing the files. I'll need dropbox to run as the dropbox user, from the dropbox users home directory.

I think the following command will launch dropbox as the dropbox user, in the dropbox users home directory, would you correct me if this doesn't work?

LANG=en_US.UTF-8 sudo -H -u dropbox ./.dropbox-dist/dropbox end script   
share|improve this question
    
Doesn't putting this in your crontab, as suggested on the wiki page you referenced, work? @reboot $HOME/.dropbox-dist/dropboxd –  garyjohn Nov 11 '11 at 18:36
    
I just looked at man 5 crontab, and it seems fedora does support that. I was actually looking at making systemd run the command as a service, but if no one known how to write a systemd startup file, I'll use that. Thanks –  Varun Madiath Nov 11 '11 at 19:02

1 Answer 1

My guesses are:

  1. You specified the wrong path to the dropbox command; ./ always refers to the current directory, which is not changed by using sudo -H. You would still have to use /home/dropbox/.dropbox-dist/dropbox.

  2. Dropbox is refusing to start because of end script in the command line. It is not part of the command – the original Upstart example was supposed to be of several lines:

    start on runlevel 2
    start on runlevel 3
    start on runlevel 4
    start on runlevel 5
    stop on shutdown
    respawn
    script
        # Without next line DB does not sync non ASCII characters (ubuntu 10.04-x86_64, db 0.7.110)
        export LANG=en_US.UTF-8
        cd /home/dropbox
        exec sudo -H -u dropbox ./.dropbox-dist/dropbox
    end script
    

    As you can see, the Upstart config cd's to /home/dropbox before referring to ./.dropbox-dist.


For systemd, create a /etc/systemd/system/dropbox.service:

[Unit]
Description=Dropbox as a system service

[Service]
ExecStart=/home/dropbox/.dropbox-dist/dropbox
User=dropbox
# 'LANG' might be unnecessary, since systemd already sets the
# locale for all services according to "/etc/locale.conf".
# Run `systemctl show-environment` to make sure.
Environment=LANG=en_US.utf-8

[Install]
WantedBy=multi-user.target

Use systemctl start dropbox.service to start the service now.

Use systemctl enable dropbox.service to make it start automatically at boot.

If you edit the unit file after it has been used once, run systemctl daemon-reload to clear the cached-in-memory one.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.