LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Editing at the command line (https://www.linuxquestions.org/questions/linux-general-1/editing-at-the-command-line-517744/)

subnet_rx 01-09-2007 01:06 PM

Editing at the command line
 
I have a couple of simple questions that I can't seem to figure out. I usually work on the desktop, but I'm working on a server through the terminal now so it's kind of new to me. First, when I type crontab -e (to edit the crontab file), what editor am I getting? I'm having trouble finding my around in it. Second, to execute a php file in this cron job, would I use /usr/bin/php path_to_file?

colucix 01-09-2007 01:11 PM

Regarding the first question, normally crontab -e uses /bin/vi, but eventually you have to specify the editor by setting the environment variable EDITOR, e.g.

Code:

export EDITOR=/bin/vi in bash/sh
setenv EDITOR /bin/vi in tcsh/csh

For the second issue, I have no idea... never used php, sorry.

anomie 01-09-2007 01:12 PM

The default editor for crontab in every Linux distro I've seen is vi. If you'd like to edit with nano, for example, you can use:
Code:

[hector@troy ~]$ export EDITOR=nano
[hector@troy ~]$ crontab -e

As for the second question, your cronjob should either build the PATH you need or use absolute paths to programs. So, presuming that's the location of the php program, your idea is probably correct.


All times are GMT -5. The time now is 09:28 AM.