# Getting a terminal script to run in cron



## hammer32 (Jan 24, 2003)

I've got a shell script that runs fine if I drop it onto a terminal window, it also runs if I tell Cronnix to "Run Now", but doesn't run at all when I tell CronniX to run it at a set time. I imagine that it's because Terminal and the Run Now command in CronniX use tcsh and cron doesn't... Anyone know a way around this?

Thanks!

Code:

#!/bin/sh
# Run xmltv for 10 days
# Args:   
#
#
#get day in YYYYMMDD format
username=YOURSHORTUSERNAME
cdat=`date +%Y%m%d`
#
echo Running tivoGuide for date:  $cdat
#
cd /sw/xmltv-0.5.6/grab/na
#
# Delete Old/Recreate
#
echo Removing PAGES-SHOWS directories
rm -rf SHOWS 
#
echo Remaking the PAGES-SHOWS directories
mkdir SHOWS
#
#
echo Running tv_grab_na $cdat+10
./tv_grab_na --days 10 >listings.xml
echo Running parsexmlguide $cdat+10
perl parsexmlguide.pl


----------



## scruffy (Jan 24, 2003)

I doubt the choice of shells would make much difference - it's specified as /bin/sh in the first line anyway.  In case though, try forcing sh to run it:

/bin/sh myscript

Sorry I'm not familiar with where Cronnix puts its files, so I can't advise you on what to look for.  I just use the crontab command on those rare occasions I need to schedule operations


----------



## substrate (Jan 24, 2003)

Did you set it to be executable? I only know how to do this via the command line, but you have to set it executable.

Open up a terminal, at the prompt type:

chmod ugo+rx 

Then drag the file into the terminal, after this type enter.


----------

