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

Re: one process occupying the whole cpu



see below.

On Fri, Nov 26, 2010 at 12:56, Jochen Schulz <ml@well-adjusted.de> wrote:
> Kjetil brinchmann Halvorsen:
>>
>> This si my shell (bash) script:
>>
>> # shell script to install all the packages in ~/R/allpackages,
>> # to ~/R/allinstall . Should be run from ~/R/Recommend .
>> #
>>  for FILE in ~/R/allpackages/*z
>>  do
>>     if [ -f $FILE ]
>>     then
>>        nice R CMD INSTALL  --library=~/R/allinstall --no-test-load    \
>>               --no-configure --html --no-libs --no-exec --resave-data $FILE \
>>                  || echo "Problems encountered during processing of $FILE" &
>
> The ampersand (&) at the end of the previous line sends the nice'd
> process to the background. The loop continues immediately after the
> command is started, so within a few seconds you have as many 'CMD'
> processes as you have files matching ~/R/allpackages/*z.
>
>> Any tips on how to write the script so that it becomes "nice"?
>
> Just remove the ampersand. Alternatively, if you want to run a few
> processes in parallel to use multiple cores, you can replace the whole
> loop with a find … | xargs construct. See xargs' -P option.
>
> J.

Thanks. I will look into this find ... | xargs    construct!

Some other problems: I changes my script to:

# shell script to install all the packages in ~/R/allpackages,
# to ~/R/allinstall . Should be run from ~/R/Recommend .
#
 for FILE in ~/R/allpackages/geo*z
 do
    if [ -f $FILE ]
    then
       nice -n 19 R CMD INSTALL  --library=~/R/allinstall --no-test-load    \
              --no-configure --html --no-libs --no-exec  $FILE \
                 >2 ./errorlog.out >1 ./log.out                 \
                 || echo "Problems encountered during processing of $FILE"
    fi
 done
#

( I loop over a smaller subset of files, for debugging purposes)

Another problem:
I made the log files with
touch errorlog.out log.out
chmod ugoa+rw log.out errorlog.out

But still I get the error:
* DONE (geozoo)
./install.all: 13: ./errorlog.out: Permission denied
Problems encountered during processing of
/home/kjetil/R/allpackages/geozoo_0.4.2

¿Why can't it write to that file?

Kjetil


> --
> I wish I had been aware enough to enjoy my time as a toddler.
> [Agree]   [Disagree]
>                 <http://www.slowlydownward.com/NODATA/data_enter2.html>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAkzv2JUACgkQ+AfZydWK2zmwiwCeP3akLxzIISOJ+24IaxIa6vjA
> OGsAn3xHXNSG2RPfLV68AWKxSOxE4IBZ
> =/wPq
> -----END PGP SIGNATURE-----
>
>



-- 
"If you want a picture of the future - imagine a boot stamping on the
human face - forever."

George Orwell (1984)


Reply to: