Re: /etc/crontab won't run my script

2009-04-24 Thread Ghirai
On Fri, 24 Apr 2009 11:39:21 -0400
Jerry McAllister  wrote:

> On Fri, Apr 24, 2009 at 06:14:26PM +0300, Ghirai wrote:
> 
> > On Fri, 24 Apr 2009 18:08:13 +0300
> > Ghirai  wrote:
> > 
> > > Hi,
> > > 
> > > I'm trying to get a python script to run from /etc/crontab, but it
> > > won't work.
> > > 
> > > I've read about the most common issues being related to paths,
> > > but my script uses no paths at all.
> > > 
> > > This is my /etc/crontab line:
> > > 
> > > */5 *   *   *   *
> > > munin   /usr/local/bin/python /root/myscript.py
> > > >> /var/log/myscript.log
> > > 
> > > I used munin user because i already have it (can i run it under
> > > 'nobody'?).
> > > 
> > > This is what /var/log/cron says:
> > > 
> > > Apr 24 18:00:01 triton /usr/sbin/cron[4361]: (munin) CMD
> > > (/usr/local/bin/python /root/myscript.py
> > > >> /var/log/myscript.log)
> > > 
> > > 
> > > However the script doesn't seem to run at all.
> > > 
> > > Obviously it works if i run it stand-alone, as any user.
> > > I'm running 7.1-RELEASE-p4, i386.
> > > 
> > > What am i doing wrong?
> > > 
> > > Thanks.
> > > 
> > 
> > Ok i just changed 'who' column to root and it works.
> > Why won't it work as any other user?
> > Permissions for myscript.py are 555.
> 
> Isn't /etc/crontab the root cron and should not be used by users?
> 
> To set up a crontab for a user, do: crontab -e
> while logged in as that user.   You can also do it from root
> by using the   -u user_name   option in the command, eg.  if
> the user is joe crontab -u joe -e
> 
> You should never edit the tab files directly.
> 
> You may also have to set up  /var/cron/allow  and  /var/cron/deny
> files.
> 
> In addition, the ownership and permissions on the files/scripts
> you are trying to run from cron must be correct.
> 
> jerry

Alright, i added the cron for 'nobody' as above, and it seems to work.

Thanks everyone.

-- 
Regards,
Ghirai.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: /etc/crontab won't run my script

2009-04-24 Thread Jerry McAllister
On Fri, Apr 24, 2009 at 06:14:26PM +0300, Ghirai wrote:

> On Fri, 24 Apr 2009 18:08:13 +0300
> Ghirai  wrote:
> 
> > Hi,
> > 
> > I'm trying to get a python script to run from /etc/crontab, but it
> > won't work.
> > 
> > I've read about the most common issues being related to paths, but my
> > script uses no paths at all.
> > 
> > This is my /etc/crontab line:
> > 
> > */5 *   *   *   *
> > munin   /usr/local/bin/python /root/myscript.py
> > >> /var/log/myscript.log
> > 
> > I used munin user because i already have it (can i run it under
> > 'nobody'?).
> > 
> > This is what /var/log/cron says:
> > 
> > Apr 24 18:00:01 triton /usr/sbin/cron[4361]: (munin) CMD
> > (/usr/local/bin/python /root/myscript.py
> > >> /var/log/myscript.log)
> > 
> > 
> > However the script doesn't seem to run at all.
> > 
> > Obviously it works if i run it stand-alone, as any user.
> > I'm running 7.1-RELEASE-p4, i386.
> > 
> > What am i doing wrong?
> > 
> > Thanks.
> > 
> 
> Ok i just changed 'who' column to root and it works.
> Why won't it work as any other user?
> Permissions for myscript.py are 555.

Isn't /etc/crontab the root cron and should not be used by users?

To set up a crontab for a user, do: crontab -e
while logged in as that user.   You can also do it from root
by using the   -u user_name   option in the command, eg.  if
the user is joe crontab -u joe -e

You should never edit the tab files directly.

You may also have to set up  /var/cron/allow  and  /var/cron/deny  files.

In addition, the ownership and permissions on the files/scripts
you are trying to run from cron must be correct.

jerry


jerry

> 
> -- 
> Regards,
> Ghirai.
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: /etc/crontab won't run my script

2009-04-24 Thread Martin McCormick
Usually, when cron tries to run something unsuccessfully, an
error message goes to root. You might look at root's mail to see
if there are any complaints regarding this script. They could be
anything from path-related troubles to permissions, etc.

The mail may also be going to the user defined in the
/etc/crontab table who field so you might find something there.
There should be some tracks unless you have piped the output to
/dev/null 2>&1 which will send both standard output and standard
error to the great bit bucket in the sky.

Martin McCormick WB5AGZ  Stillwater, OK 
Systems Engineer
OSU Information Technology Department Telecommunications Services Group
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: /etc/crontab won't run my script

2009-04-24 Thread Ghirai
On Fri, 24 Apr 2009 11:17:13 -0400
Glen Barber  wrote:

> On Fri, Apr 24, 2009 at 11:14 AM, Ghirai  wrote:
> >
> > Ok i just changed 'who' column to root and it works.
> > Why won't it work as any other user?
> > Permissions for myscript.py are 555.
> >
> 
> Who owns the file?
> 

root:wheel

-- 
Regards,
Ghirai.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: /etc/crontab won't run my script

2009-04-24 Thread Glen Barber
On Fri, Apr 24, 2009 at 11:14 AM, Ghirai  wrote:
>
> Ok i just changed 'who' column to root and it works.
> Why won't it work as any other user?
> Permissions for myscript.py are 555.
>

Who owns the file?


-- 
Glen Barber
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: /etc/crontab won't run my script

2009-04-24 Thread Ghirai
On Fri, 24 Apr 2009 18:08:13 +0300
Ghirai  wrote:

> Hi,
> 
> I'm trying to get a python script to run from /etc/crontab, but it
> won't work.
> 
> I've read about the most common issues being related to paths, but my
> script uses no paths at all.
> 
> This is my /etc/crontab line:
> 
> */5 *   *   *   *
> munin   /usr/local/bin/python /root/myscript.py
> >> /var/log/myscript.log
> 
> I used munin user because i already have it (can i run it under
> 'nobody'?).
> 
> This is what /var/log/cron says:
> 
> Apr 24 18:00:01 triton /usr/sbin/cron[4361]: (munin) CMD
> (/usr/local/bin/python /root/myscript.py
> >> /var/log/myscript.log)
> 
> 
> However the script doesn't seem to run at all.
> 
> Obviously it works if i run it stand-alone, as any user.
> I'm running 7.1-RELEASE-p4, i386.
> 
> What am i doing wrong?
> 
> Thanks.
> 

Ok i just changed 'who' column to root and it works.
Why won't it work as any other user?
Permissions for myscript.py are 555.

-- 
Regards,
Ghirai.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"