-2

I recently got an VPS to experiment, I have installed Centos and is trying to see if I can setup hostbill and run it from there. The installation all worked out well but I am stumped when it comes to setting up a cron job. I need to setup the following job:

*/5 * * * * php -q /var/www/html/bill/hostbill/admin/cron.php

but I have never before done it using command line, used to do it from the comfort of cPanel. Now I did look up a bit and did the following. Logged in as root and then in the console hit crontab -e, inserted the job I wanted to run and then exit the text editor. I keep getting this error:

/bin/bash: q: command not found

shell returned 127. I am really a newbie when it comes to linux and managing a VPS could you guys help me out a bit?

Here is the full command I am using

crontab -e 

this opens nano there i type

*/5 * * * * php -q /var/www/html/bill/hostbill/admin/cron.php

then i press ctrl+o and then :!q to close nano as soon as nano closes I get the following errors in the console

no crontab for root - using an empty one
[No write since last change]
/bin/bash: q: command not found

shell returned 127

Press ENTER or type command to continue
user9517
  • 114,104
  • 20
  • 206
  • 289
Rick Roy
  • 215
  • 1
  • 5
  • 15
  • Post the full commands you are using and the full output. What you are doing is correct; we need to work out why the error is coming up. – fukawi2 Nov 14 '13 at 05:29

1 Answers1

3

Those commands ":!q" looks like vi commands, but in the wrong order.

The way you're doing it now, "!q" means "start a shell" (!)" and "run the command 'q'".

The reverse, ":q!" means "quit and don't save, and don't ask me to save changes, I really want to quit."

Try ":wq" to "write" then "quit".

whitepaws
  • 377
  • 1
  • 2