[Lvlug] Crontab & cron

User Fwc fwc at frankcole.lvcm.com
Sun Mar 7 21:26:46 PST 2010


On Sun, 7 Mar 2010, High Mobley wrote:

> I think with cron, you don't get the full shell environment, so the
> working directory is probably not your home directory.  It would be
> interesting to see where the output was going before you specified the
> full path.  Maybe try this:
>
> locate cronout
>
Ended up in my home directory, IE
/usr/home/fwc/cronout
instead of
/usr/home/fwc/temp/cronout

Interesting. Wonder if I could use ./temp/cronout in the script...

Yup - worked. Looks like script output written relative to $HOME of user 
(me).

Try the same stunt in the crontab
ibm~/temp% crontab -l
0-59/5  *       *       *       *       ./temp/timestamps

Yup - Also worked.

Think I'll have a drink  :-)
Thanks High.

>
>
> On Sun, Mar 7, 2010 at 8:17 PM, User Fwc <fwc at frankcole.lvcm.com> wrote:
>> On Sun, 7 Mar 2010, High Mobley wrote:
>>
>>> How about specifying an absolute path to the cronout file?
>>>
>> Huh - That did it. Script modified to
>>
>> #!/bin/sh
>> /bin/date >> /usr/home/fwc/temp/cronout
>>
>> 'cronout' file appended to every five minutes.
>>
>> Now back to the main problem - taking apart logfiles with sh/ksh, sed, &
>> awk.
>>
>>>
>>>
>>>
>>> On Sun, Mar 7, 2010 at 7:51 PM, User Fwc <fwc at frankcole.lvcm.com> wrote:
>>>>
>>>> On Sun, 7 Mar 2010, User Fwc wrote:
>>>>
>>>>> Playing with crontab and can't get the entry to execute.
>>>>>
>>>>> Cron running, top shows
>>>>> 734 root          1   8    0  3212K  1288K nanslp 1   0:00  0.00% cron
>>>>>
>>>>> crontab -l shows
>>>>> 0-59/5  *       *       *       *       /usr/home/fwc/temp/timestamps
>>>>>
>>>>> Crontabs file under
>>>>> /var/cron/tabs
>>>>> shows
>>>>> # DO NOT EDIT THIS FILE - edit the master and reinstall.
>>>>> # (/tmp/crontab.2PvlqUcoLo installed on Sun Mar  7 18:53:53 2010)
>>>>> # (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v
>>>>> 1.24.6.1 2008/11/25 02:59:29 kensmith Exp $)
>>>>> 0-59/5  *       *       *       *       /usr/home/fwc/temp/timestamps
>>>>>
>>>>> The 'timestamps' script is
>>>>> #!/bin/sh
>>>>> date >> cronout
>>>>> and it will execute from the command line.
>>>>>
>>>>> Permissions are
>>>>> -rwxr--r--  1 fwc  fwc        27 Mar  7 18:13 timestamps*
>>>>>
>>>>> I've even tried restarting the machine.
>>>>> She no work. Ideas?
>>>>
>>>>
>>>> Replying to myself here.
>>>>
>>>> Looked at /var/log/cron with 'tail -f', crontab line shows as being run.
>>>> Mar  7 19:45:00 ibm /usr/sbin/cron[1175]: (fwc) CMD
>>>> (/usr/home/fwc/temp/timestamps)
>>>>
>>>> Also included path to 'date' in timestamps, no help.
>>>> #!/bin/sh
>>>> /bin/date >> cronout
>>>>
>>>> Out of ideas...
>>>> _______________________________________________
>>>> Sent via the Lvlug mailing list Lvlug at lvlug.org
>>>> Set options or unsubscribe at http://lvlug.org/mailman/listinfo/lvlug
>>>> The Lvlug mailing list is hosted courtesy of LasVegas.Net
>>>>
>>> _______________________________________________
>>> Sent via the Lvlug mailing list Lvlug at lvlug.org
>>> Set options or unsubscribe at http://lvlug.org/mailman/listinfo/lvlug
>>> The Lvlug mailing list is hosted courtesy of LasVegas.Net
>>
>> _______________________________________________
>> Sent via the Lvlug mailing list Lvlug at lvlug.org
>> Set options or unsubscribe at http://lvlug.org/mailman/listinfo/lvlug
>> The Lvlug mailing list is hosted courtesy of LasVegas.Net
>>
>>
> _______________________________________________
> Sent via the Lvlug mailing list Lvlug at lvlug.org
> Set options or unsubscribe at http://lvlug.org/mailman/listinfo/lvlug
> The Lvlug mailing list is hosted courtesy of LasVegas.Net
>


More information about the Lvlug mailing list