[CS-FSLUG] How to run a cron script?
Frank Bax
fbax at sympatico.ca
Fri Dec 31 11:09:37 CST 2004
At 11:57 AM 12/31/04, Jerry VanBrimmer wrote:
>On Fri, Dec 31, 2004 at 08:45:21AM -0500, Frank Bax wrote:
> > At 02:54 AM 12/31/04, Jerry VanBrimmer wrote:
> >
> > >I have this script, called rsync_demo, that I have put in ~/bin. I created
> > >this script to download updates from a Slackware mirror and put them in
> > >a folder on my machine. If I run the script manually from a terminal like
> > >this:
> > >
> > >$ /home/jerry/bin/./rsync_demo.sh
> > >
> > >it works just fine and does exactly what I want.
> > >
> > >Trouble is, I can't get cron to run the script from my crontab.
> >
> >
> > For myself, the most common cause for this is that path is not the same in
> > crontab as it is in a terminal session. Try adding PATH= to the crontab,
> > or specify full path to commands used inside your script.
>
>I have added the path to ~/bin to "jerry"'s PATH. So I don't think
>that's it. But, I'll try it anyway.
I was thinking about the commands inside rsync_demo.sh, rather than finding
rsync_demo.sh itself.
> > Are you sure the problem is that the script does not run in cron, or is
> the
> > problem that log file is not changed? Does 'jerry' has rights to write to
> > /var/log/messages ?
>
>Yes, I'm sure cron isn't running the script. Because I watch for it in
>KDE System Guard. When I run it by hand it shows up in the list of
>processes. When I wait for cron to run it, it never shows up.
Do cron log files give any indication why script is not running?
>You are right about one thing. User jerry does not have write perms on
>/var/log/messages. Would it be okay to allow that, or should I direct
>that output to another log, say to ~/rsync_log ?
Personally, I'd use a different log file, but adding jerry to wheel group
(or use 'sudo') should allow that user to write to /var/log/messages.
More information about the Christiansource
mailing list