[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: crontab and users?



David Bellows wrote:
> Hello all,
> 
> I'm having problems getting cron to work as a user.  I'm trying to get
> the progam jac (a command line CD player that does work, btw) to run at
> specific times to act as an alarm clock.  As a user here is my crontab:
> 
> 38 17 * * * /usr/local/bin/jac -P1
>  
> Which should mean that it will play at 5:38 PM.
> 
> This same crontab installed by root works!  Is there some kind of
> permission thing to allow users to use cron?

One thing that you must be carefull of is to make absolutely sure that there
is a line feed at the end of that line.  As an example:

HAL9000:~$ crontab -l
MAILTO=""
COMMAND="/home/mike/fetchmail.sh start"
#hr min dom mon   dow   command
01  10   *   *     *    $COMMAND
15  08   *   *     *    br -N


HAL9000:~$ 

The blank lines between the last line of the crontab and the shell prompt
are there for that exact reason.

Are you by chance trying to do this via the /etc/crontab file?  If you are,
then you shouldn't be.  If, on the other hand, you are doing it via the
crontab -e command, then it *should* be working for you.

Something else that just occured to me.  From the crontab manpage:

       If the /etc/cron.allow  file  exists,  then  you  must  be
       listed therein in order to be allowed to use this command.

Check to see if that file is there.  If it is, then either get rid of it or
put your username into it.

> Btw, is there a user that I can specify in cron that will work without
> being logged in (in case power goes out and I don't wake up and log back
> in)?

You do not have to be logged in to have a cron job run.  The crontab I
inserted above works just fine if I'm not logged onto my box.
-- 
Mike Werner  KA8YSD   | He that is slow to believe anything and
                      | everything is of great understanding,
'91 GS500E            | for belief in one false principle is the
Morgantown WV         | beginning of all unwisdom.



Reply to: