0

I have used this command directly with the command line and it working fine.

sudo ~/.dropbox-dist/dropboxd

But when I set it to run each minute with cronjob nothing happens. my crontab file

# m h  dom mon dow   command
* * * * * sudo ~/.dropbox-dist/dropboxd
@hourly wget -qO /dev/null https://mysite.com/cron/KpFh734nRJIBMtAAH1-32ajb8Rv23A-l0pBVg$

what is wrong?

2

Generally speaking, crontab is not aware of environment variables. You should indicate the full path. In this example it may be:

/home/youruser/.dropbox-dist/dropboxd

sudo may need a password, so it may not achieve what you expect in a cron job. It may just be an example, but I am puzzled by the fact that you need to run the Dropbox deamon every minute.

| improve this answer | |
  • I try this * * * * * dev.ecc /home/dev.ecc/.dropbox-dist/dropboxd and * * * * * root /home/dev.ecc/.dropbox-dist/dropboxd but not working – Nasser Ali Karimi May 12 '19 at 7:43
  • Is there any specific reason to use sudo, or are you escalating privilegies just because it doesn't work without? I think you may have messed up permissions in your /home/dev.ecc/.dropbox-dist folder. You may want to straighten this up with a chmod -R dev.ecc:dev.ecc /home/dev.ecc/.dropbox-dist – Arduous May 12 '19 at 7:58
  • in this command sudo ~/.dropbox-dist/dropboxd it not working without sudo, and when I use that it working and files can sync with dropbox, and also up to when the command running, just when I ctrl+c it stop and sync process stop. – Nasser Ali Karimi May 12 '19 at 8:01
  • 1
    It should be working without higher privilegies. See my previous edited comment to sort this up. Then, you do not need to restart the synchronization daemon every minute. It should tun in the background. From the doc at dropbox.com/install-linux dropboxd should fork to run in background, but sudo may be interfering. Worst case, you could run it with /home/dev.ecc/.dropbox-dist/dropboxd & . Notice the ampersand (&) at the end of the command. – Arduous May 12 '19 at 8:06
1

It shouldn't be sudo. Should be the user name. And don't use ~ , use absolute path. like

* * * * * root /home/user/.dropbox-dist/dropboxd

or

* * * * * user /home/user/.dropbox-dist/dropboxd

Also please note that in either case, root or user should have execute permission on the script.

| improve this answer | |
  • I try this * * * * * dev.ecc /home/dev.ecc/.dropbox-dist/dropboxd and * * * * * root /home/dev.ecc/.dropbox-dist/dropboxd but not working – Nasser Ali Karimi May 12 '19 at 7:43
  • can you share the permissions of the file ls -lrsth /home/dev.ecc/.dropbox-dist/dropboxd – Rohail Abbas May 12 '19 at 7:48
  • it returns>ls: cannot access '/home/dev.ecc/.dropbox-dist/dropboxd': No such file or directory, but as I said in my question the command works with command line – Nasser Ali Karimi May 12 '19 at 7:52
  • looks like your username or user directory is different. can you please share output of ls ~/.dropbox-dist/dropboxd and echo "$USER" – Rohail Abbas May 12 '19 at 8:21
  • ls: cannot access '/root/.dropbox-dist/dropboxd': No such file or directory, actually I have a user by the name of pomin that is the main user and then for each project, I have a new user that for this case is dev.ecc.new user, and the next on root@ip-172-31-21-237:~# echo "$USER" root – Nasser Ali Karimi May 12 '19 at 8:23
0

I fix the issue with change my cron command like this:

@reboot ~/.dropbox-dist/dropboxd

but this is not enough and I should run another command:

($HOME/.dropbox-dist/dropboxd &)&

after this for the test when I run this command

sudo ~/.dropbox-dist/dropboxd

I will see this message that means Dropbox is running, and all changes will sync with Dropbox account immediately.

Another instance of Dropbox (25068) is running!

| improve this answer | |
  • Using @reboot in the crontab can make sense, but using a service or a planned task when the desktop environment would be cleaner 1) Ensure that the crontab you are adding this directive to is the crontab of the correct user and 2) Use the full path, and not the ~ shortcut! Do you have an encrypted home folder? Can you post the result of ps auwx | grep dropboxd and mount before you run it manually? – Arduous May 13 '19 at 8:27
  • The dropbox Linux installed globally on the server, and in my case, I just want it for a specific project.This is the result of first command pomin 14767 0.0 0.0 12948 912 pts/0 S+ 08:40 0:00 grep --color=auto dropboxd – Nasser Ali Karimi May 13 '19 at 8:42
  • From this output, it is clear that dropboxd is not running. I let you address the other points and questions from my previous comment. – Arduous May 13 '19 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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