Results 1 to 9 of 9

Thread: Bash script with low priority

  1. #1

    Default Bash script with low priority

    Dear all,
    I am having a bash script
    Code:
    tar -zcvf /media/a9f299d7-9775-404d-a073-fcac2813f1c0/user-caus`date '+%d-%B-%Y'`.tar.gz /etc /root /home 2>> /root/backup/backuperrors.txt
    that I have noticed that makes my computer too slow when running (it utilizes cpu and the bus). How I can make it run with low priority (cpu and i/o)?

    B.R
    Alex

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,527
    Blog Entries
    15

    Default Re: Bash script with low priority

    Quote Originally Posted by alaios
    Dear all,
    I am having a bash script

    Code:
    --------------------
    tar
    -zcvf /media/a9f299d7-9775-404d-a073-fcac2813f1c0/user-caus`date
    '+%d-%B-%Y'`.tar.gz /etc /root /home 2>> /root/backup/backuperrors.txt
    -------------------- that I have noticed that makes my computer too
    slow when running (it utilizes cpu and the bus). How I can make it run
    with low priority (cpu and i/o)?

    B.R
    Alex

    Hi
    Why not just rsync the files?

    --
    Cheers Malcolm °¿° (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 3.0.13-0.27-default
    up 15:52, 2 users, load average: 0.02, 0.03, 0.05
    CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU


  3. #3

    Default Re: Bash script with low priority

    Because I never used rsync
    1)I do not know how it does
    2) I am not sure if it can apply some compression to the files, so have my files take less storage.

    Can you give a brief example of what you mean?

    Alex

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,527
    Blog Entries
    15

    Default Re: Bash script with low priority

    Quote Originally Posted by alaios
    Because I never used rsync
    1)I do not know how it does
    2) I am not sure if it can apply some compression to the files, so have
    my files take less storage.

    Can you give a brief example of what you mean?

    Alex
    Hi
    This is a sample of what I use on my systems here;
    Code:
    # rsync options
    # r option: recurse into directories
    # l option: copy symlinks as symlinks
    # t option: preserve times
    # u option: skip files that are newer on the receiver
    # z option: compress file data during the transfer
    # i option: output a change-summary for all updates
    # v option: increase verbosity
    
    FILENAME=/tmp/backup.`date +\%s`
    /usr/bin/rsync -rltuzi --stats --progress --delete \
    /home/<username>/.* /media/BACKUP/<system_name>_backup_121/ \
    > $FILENAME
    /usr/bin/tr -d '\015' < $FILENAME | /usr/bin/mailx -s 'User <username> home Backup (openSUSE) via RSYNC to USB Disk' username@localhost \
    # Delete backup file
    rm $FILENAME
    I don't worry about config files from /etc if there are some specific
    ones, I run a /data partition and create symlinks to config files
    that reside on /data. My /data gets backed up via rsync in one sweep.

    There are a couple I bzip2 and copy but only two files rather than a
    whole directory structure.

    --
    Cheers Malcolm °¿° (Linux Counter #276890)
    SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 3.0.13-0.27-default
    up 16:19, 2 users, load average: 0.23, 0.07, 0.06
    CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU


  5. #5
    Join Date
    Jun 2009
    Location
    Pennsylvania, USA
    Posts
    233

    Default Re: Bash script with low priority

    alaios wrote:

    >
    > Dear all,
    > I am having a bash script
    >
    > Code:
    > --------------------
    > tar -zcvf /media/a9f299d7-9775-404d-a073-fcac2813f1c0/user-caus`date
    > '+%d-%B-%Y'`.tar.gz /etc /root /home 2>> /root/backup/backuperrors.txt
    >
    > --------------------
    > that I have noticed that makes my computer too slow when running (it
    > utilizes cpu and the bus). How I can make it run with low priority (cpu
    > and i/o)?
    >
    > B.R
    > Alex
    >
    >


    Look at 'man 1 nice' in a terminal, or (in KDE) hit Alt+F2 and enter '#nice'
    (without the quotes).



  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,952
    Blog Entries
    2

    Default Re: Bash script with low priority

    Quote Originally Posted by GeoBaltz View Post
    alaios wrote:

    >
    > Dear all,
    > I am having a bash script
    >
    > Code:
    > --------------------
    > tar -zcvf /media/a9f299d7-9775-404d-a073-fcac2813f1c0/user-caus`date
    > '+%d-%B-%Y'`.tar.gz /etc /root /home 2>> /root/backup/backuperrors.txt
    >
    > --------------------
    > that I have noticed that makes my computer too slow when running (it
    > utilizes cpu and the bus). How I can make it run with low priority (cpu
    > and i/o)?
    >
    > B.R
    > Alex
    >
    >


    Look at 'man 1 nice' in a terminal, or (in KDE) hit Alt+F2 and enter '#nice'
    (without the quotes).
    Agreed,

    But I recommend re-nice instead to modify the priority of a running process since it's easier. If you want to launch a process with a pre-configured priority setting then you can apply nice but be prepared for some difficulties.

    HTH,
    TS

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Bash script with low priority

    On 2012-04-17 17:06, alaios wrote:

    > How I can make it run with low priority (cpu
    > and i/o)?


    nice for cpu, ionice for io.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  8. #8

    Default Re: Bash script with low priority

    Hmm.. I did not know that there is a second command for i/o access. I thought that was done only through nice. The reason for that I though was it makes more sense (at least to me ) to have the kernel decide how to handle both. Would not be weird to have a priority running for example with highest priority (nice, renice) and have the i/o access to loweset (ionice).
    How that would behave?

    To. malcolmlewis: Have more questions regarding rsync. I will make new post (bit later) concerning only rsync questions.

    Regards
    Alex

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Bash script with low priority

    On 2012-04-19 08:56, alaios wrote:
    >
    > Hmm.. I did not know that there is a second command for i/o access.


    Well, there is; and it is relatively new and unknown.

    > I
    > thought that was done only through nice. The reason for that I though
    > was it makes more sense (at least to me ) to have the kernel decide
    > how to handle both. Would not be weird to have a priority running for
    > example with highest priority (nice, renice) and have the i/o access to
    > loweset (ionice).
    > How that would behave?


    The kernel does indeed decide, but you can tell the kernel to adapt somehow
    to your preferences. CPU niceness and I/O niceness are different things,
    thus different command apply. Yes, there could be a newer program doing
    both, but there isn't, such is life. "nice" is a traditional unix command,
    can not be changed, I guess.


    > To. malcolmlewis: Have more questions regarding rsync. I will make new
    > post (bit later) concerning only rsync questions.


    Nevertheless, the I/O problem will remain, except that rsync moves less
    data if a large portion remains unchanged.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •