Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running Ubuntu Server 9.04 in VirtualBox on my work PC as a development environment. I have some scripts that I've put in my user's crontab that run throughout the day while I'm SSHed into the VM.

Last night, I closed PuTTy and all of my other running applications (except for VirtualBox and the VM) and went home. I came back this morning to discover that my cron jobs didn't run at all, yet when I SSHed into the VM, the next scheduled job ran. I set the schedule to 5min to test, disconnected again, and the jobs stopped running on schedule.

They seem to only run if I'm logged in to the machine. Obviously, I want them to run on schedule even if I'm not logged in to the VM, otherwise there's no point.

Is there something I've failed to configure correctly?

New Information:

There are now 3 entries in /var/log/cron.log saying the following "Mount of private directory return code [256]"... the entries correspond to when the cron job is supposed to run.

I thought they are supposed to run as my userid? Why would my own userid be unable to run a script in my home directory?

share|improve this question
    
As long as the server is running (And VirtualBox isn't shutting it down for some reason when you log off) the cron should run. How are you setting up the cron? Also, can you check the logs to make sure that the system is actually up? /var/log/messages might give you some hints as well. –  Dave Drager Sep 3 '09 at 15:10
    
/var/log/messages was clean. /var/log/cron.log said: Sep 3 11:18:01 mike-test /usr/sbin/cron[15296]: (mike) RELOAD (crontabs/mike) Sep 3 11:20:01 mike-test /USR/SBIN/CRON[15437]: (smmsp) CMD (test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp) Sep 3 11:20:01 mike-test /USR/SBIN/CRON[15439]: (root) CMD ([ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null) Sep 3 11:20:28 mike-test crontab[15531]: (mike) LIST (mike) It was supposed to run at 11:20, but all it says is "LIST". –  Michael Moussa Sep 3 '09 at 15:26

1 Answer 1

up vote 2 down vote accepted

It would appear that you are trying to run a cron job as your user, and that you have some form of encrypted home directory set up.

Your home directory (or some subset thereof) is unlocked and mounted when you log in, but when you are logged out, your home directory is unavailable, thus the error in your logs.

You should remove the encryption, run the cron job as another user, or you could try to run the job as your user but specifying a different environment (HOME, most notably).

share|improve this answer
    
On Ubuntu, this is probably controlled by ecryptfs-mount-private and friends. As you say, he needs to choose between having it encrypted, and having it accessible when he's not there to unlock it. –  poolie Nov 23 '10 at 5:55

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.