[ale] sometimes I hate bash
Jim Kinney
jim.kinney at gmail.com
Wed Dec 16 21:20:04 EST 2009
WOOHOO!!!!! SUCCESS!!!!!
It was the I/O redirect with script messing up inside a redirected cron
environment
do_process_foo param 1 param2 >> $log_file 2>&1
What a brilliantly simple thing that is reliable and stupid easy.
Until I have to come along and live up the nickname Aaron and Jeff gave me
"The OverEngineer"
sheesh....
On Wed, Dec 16, 2009 at 8:43 PM, Jim Kinney <jim.kinney at gmail.com> wrote:
> I follow you. Yes, I am running scripts not -exec 'ing external scripts.
> cd foo
> script -a -c "./bar.sh param1 param2" "$log_file
>
> wash, rinse, repeat...
>
> It really is a difference between how processes are handled between the two
> different environment of a regular login and a cron job. I'm rewriting my
> logger to be basic bash I/O redirects. I think that will resolve the nasty
> looping processes. script is designed to be able to replay process. Tht's
> probably not a good thing to have as an automated function :-)
>
>
> On Wed, Dec 16, 2009 at 8:32 PM, Ed Cashin <ecashin at noserose.net> wrote:
>
>> On Wed, Dec 16, 2009 at 6:49 PM, Jim Kinney <jim.kinney at gmail.com> wrote:
>> > script runs all hunky-dorey in userland.
>> >
>> > so time to put it into cron. To cover my bases for inferior cron
>> > environemnt, the first thing the script does is . ~/.bash_profile which
>> in
>> > turn runs ~/.bash_rc which runs /etc/bashrc
>>
>> If you are "running" scripts, you're creating new bash processes, but
>> if you use exec instead, you'll replace the running process with a new
>> one.
>>
>> ecashin at Ed-Cashins-MacBook-Pro ~$ cat /tmp/count-procs
>> #! /bin/sh
>> ps ax | wc -l
>> ecashin at Ed-Cashins-MacBook-Pro ~$ cat /tmp/test-run
>> /tmp/count-procs
>> ecashin at Ed-Cashins-MacBook-Pro ~$ sh /tmp/test-run
>> 52
>> ecashin at Ed-Cashins-MacBook-Pro ~$ cat /tmp/test-exec
>> exec /tmp/count-procs
>> ecashin at Ed-Cashins-MacBook-Pro ~$ sh /tmp/test-exec
>> 51
>> ecashin at Ed-Cashins-MacBook-Pro ~$
>>
>> ...
>> > Except somehow it now spawns _2_ copies of the running process and the
>> race
>> > is on! <insert appropriate swearing here>
>>
>> Do the above comments seem relevant? I can't really tell if that's all
>> there is to it.
>>
>> --
>> Ed Cashin <ecashin at noserose.net>
>> http://noserose.net/e/
>> http://www.coraid.com/
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>
>
>
> --
> --
> James P. Kinney III
> Actively in pursuit of Life, Liberty and Happiness
>
>
--
--
James P. Kinney III
Actively in pursuit of Life, Liberty and Happiness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20091216/e912b013/attachment-0001.html
More information about the Ale
mailing list