[nSLUG] crontab help

Stephen Gregory nslug at kernelpanic.ca
Fri Nov 2 17:47:18 ADT 2007


On Fri, Nov 02, 2007 at 02:10:04PM -0600, Vikram Chhatre wrote:
> Greg Estabrooks wrote:
> >
> > Out of curiousity,  try
> >
> >
> >  VISUAL=/usr/local/bin/nano crontab -e
> >
> > __
> 
> Breeze of fresh air.  That worked.   Can you explain how?

Many command line tools will use the environment variables EDITOR or
VISUAL to launch a text editor when required. The VISUAL environment
variable is used to specify a "visual text editor." (As opposed to an
old line based editor like ed.)

In the command line above the VISUAL= statement overrides the default
value of VISUAL before running the crontab command. Depending on the
distro you use there are different ways to set VISUAL and EDITOR at
boot time so that you don't have to set the variable every time.

In my experience VISUAL is no longer used. Hats off to Greg for
figuring it out.



> I have set up my crontab file to launch a script that in turn launches 
> mplayer to play a local radio station.  Its working fine now, but I do 
> not have a way of controlling it because mplayer is running in 
> background. Can I set it up to launch through a terminal?  I tried 
> following, but that didn't work:

Cron was not really designed for these kinds of interactive tasks but
you can mostly make it work. Try the following. 


#!/bin/sh

/usr/local/bin/aterm -display :0 -e /usr/local/bin/mplayer http://blah.url

##### 

The -display argument tells aterm where it should display. Without
that argument aterm will use the DISPLAY environment variable which is
usually not set.

-- 
sg



More information about the nSLUG mailing list