Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Cron-job issue: "FATAL: Must be run from ROOT directory of Grav!"

Started by Muut Archive 11 years ago · 9 replies · 1588 views
11 years ago

I set up a cron-job to make backups from a shell script but I get the message "FATAL: Must be run from ROOT directory of Grav!". Any ideas how to fix this?

The shell script navigates to the Grav root folder and then executes "bin/grav backup" (no quotes). I saved the script outside the /public_html folder and also in Grav's root but no luck so far.

11 years ago

Well that should work. Can you paste your script that you are running via cron?

11 years ago

Hello Andy, the .sh is below. I added the pwd just to make sure I was in the right folder.

!/bin/bash

cd /home/myuser/public_html/demo;
echo "pwd: ${PWD}"
/home/twintech/public_html/demo/bin/grav backup

The output I get:

pwd: /home/myuser/public_html/demo
X-Powered-By: PHP/5.5.30
Content-type: text/html

FATAL: Must be run from ROOT directory of Grav!

I also ran the script with "bin/grav backup" as the last line and got the same error.

11 years ago

By the way, /demo is Grav's root folder.

11 years ago

If you already cd into demo, you just need to write

BASH
#!/bin/bash
cd /home/myuser/publichtml/demo;
echo “pwd: ${PWD}bin/grav backup
11 years ago

Yeah, I tried both. Check the last line of my post.

11 years ago

Probably wont' make a difference, but you could try:

TXT
./bin/grav backup
11 years ago

It did not make a difference, same error message. :(

10 years ago

One year later, the fix was prefixing the command with "php-cli":

php-cli bin/grav backup

10 years ago

Ah that's a very server specific solution. Your server configuration obviously has php bound to the FCGI version, and requires you to specify the CLI version with php-cli

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1349 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2946 9 years ago
Archive · by Muut Archive, 9 years ago
3 1118 9 years ago