Re: cronjob in user environment
On Tue, Sep 02, 2008 at 02:18:45PM +0200, Steve S wrote:
> Hi all,
>
> I want to run a cronjob in a user's environment (i.e. as this user and
> not as root).
>
> The script foo.sh to be run by cron on behalf of the a user (johndoe)
> needs some env vars (paths) from that user's ~/.bashrc.
>
> I read about several solutions:
>
> 1) use su
>
> If I try in the crontab
>
> 10 12 * * */2 su -p - johndoe -c /home/johndoe/foo.sh
Don't edit crontab. Edit a file under /etc/cron.d . And use the
following line:
10 12 * * */2 johndoe /home/johndoe/foo.sh
(or 'cron -e' as that user, as someone has already mentioned).
--
Tzafrir Cohen | tzafrir@jabber.org | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir@cohens.org.il | | best
ICQ# 16849754 | | friend
Reply to: