Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have setup a service on my Ubuntu 10.04.4 LTS server, which works when started and stopped manually using sudo service <service> start etc.

However I would like to have the service (dropbox btw.) only running for a few hours each day, as the service uses a lot of memory.

I have added the following to my cron using crontab -e, but it doesn't work as expected:

1 5 * * * /etc/init.d/dropbox start
1 6 * * * /etc/init.d/dropbox stop

This returns the following message start-stop-daemon: not found. Am I doing it wrong and if so how do you start / stop a service at a specific time?

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted

Dropbox is not started at boot time, there is no init.d script to do it. The daemon is started at login for each user and the binaty is located in ~/.dropbox-dist/dropbox.

To start up the daemon you need to use the command

start-stop-daemon -b -o -c user -S -u user -x ~/.dropbox-dist/dropbox

and to stop it you need to use

start-stop-daemon -o -c user -K -u user -x ~/.dropbox-dist/dropbox

Where user is your username.

Source for this information is at http://ubuntuserverguide.com/2012/06/how-to-install-and-configure-dropbox-on-ubuntu-server-12-04.html. There is also a nice startup init.d script there, you might consider following that guide.

share|improve this answer
    
I was already using the init.d script from your link. However I had to add the following line above line 3 (DROPBOX_USERS line): PATH=${PATH}:/sbin to make the cron daemon find the start-stop-daemon. –  svandragt Jul 24 '12 at 9:07
    
Perfect, you can also add that an answer and accept it as the correct one since you found what was the issue with the scrip. –  Bruno Pereira Jul 24 '12 at 9:30
add comment

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.