Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot get cron to work #957

Closed
city41 opened this issue Aug 1, 2014 · 8 comments
Closed

cannot get cron to work #957

city41 opened this issue Aug 1, 2014 · 8 comments
Labels

Comments

@city41
Copy link

city41 commented Aug 1, 2014

After setting up a crouton chroot, cron does not seem to work.

What I've done:

  1. setup crouton following steps in README
  2. sudo enter-chroot
  3. crontab -e
  • added * * * * * echo "hi from cron" >> /home/matt/hiFromCron.txt"
  • after a few minutes, see no output at either /home/matt within the chroot or at the "real" /home/matt outside of the chroot (I went there and added a matt directory)

ps -A | grep cron returns nothing. It definitely looks like cron is not running.

But doing sudo /etc/init.d/cron start just produces "Rather than invoking init scripts through /etc/init.d, use the service(8) ..."

So I do sudo service cron start and get "Unknown job: cron"

And sudo start cron gives me "start: Unknown job: cron"

I'm not convinced this is a Crouton specific issue, but hoping I can get some pointers on what to try next.

@dnschneid
Copy link
Owner

crouton doesn't use upstart, so you need to run crond explicitly, probably from the chroot's /etc/rc.local. Look inside /etc/init/cron for the commands needed to launch crond.

@city41
Copy link
Author

city41 commented Aug 7, 2014

Thanks, it looks to be sudo cron is all that is needed to get cron started.

@dnschneid
Copy link
Owner

Cool! Thanks for sharing your findings.

@alexluecke
Copy link

Exactly what I needed. Thanks both y'all.

@tr0043t
Copy link

tr0043t commented Jul 18, 2015

What is the best way to run scripts inside the chroot at shutdown or reboot, for cleanup, etc.? Thanks!

@dnschneid
Copy link
Owner

There's no official mechanism for it at the moment. You may be able to make a script that gets run from rc.local that does nothing but wait for SIGTERM, and then performs your cleanup tasks. unmount-chroot will SIGTERM all child processes if it can't unmount everything, and then SIGKILL five seconds later (so hopefully your cleanup takes less than five seconds :) ).

@tr0043t
Copy link

tr0043t commented Aug 1, 2015

Hmm. Thanks. Five seconds can be pretty tight for some stuff though.

@dnschneid
Copy link
Owner

You could modify unmount-chroot to change that timeout. Otherwise, you'll probably have to try some other approach. Also worth noting is that while there's a system dbus message that gets fired on shutdown, crouton doesn't actually respond to it, so even the SIGTERM approach may not work for the shutdown case...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants