1

This is a bit of a mystery to me since you have to "be in" the folder of the Cakefile to run the cake command. I don't really know where cake its path from, but I've tried running this

cd /
PWD=/path/to/cake/file cake server

Still getting this error:

Error: Cakefile not found in /

Would something like

cd /path/to/cake/file && cake server

Work in a cron file? Also could that pose a problem for the remaining cron jobs?

Hubro
  • 56,214
  • 69
  • 228
  • 381

3 Answers3

3

You can use () to make a subshell to run your command without affecting the rest:

(cd /path/to/cake/file && cake server)
kev
  • 155,172
  • 47
  • 273
  • 272
1

That's what I've done in the past for rake tasks, something like

cd /home/user/reports && /usr/local/bin/rake -f /home/user/code/stats/current/Rakefile report:generate_file

in a cron job to set the directory it's running out of. It doesn't cause any problems for any following cron jobs.

Waynn Lue
  • 11,344
  • 8
  • 51
  • 76
1

It should work without any problems. Launching a subshell should not be necessary.

This works with cronie, but it should also work with dcron.

Malte Bublitz
  • 236
  • 1
  • 3