Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to set nice value of at jobs?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
ewg
n00b
n00b


Joined: 02 Aug 2005
Posts: 28

PostPosted: Mon Aug 08, 2005 6:59 pm    Post subject: how to set nice value of at jobs? Reply with quote

Hi,

I use at frequently to execute commands later. By default, these jobs are executed with a nice value of 2. How can I make atd give them a nice value of 0?

Thanks,
Eckhart
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Mon Aug 08, 2005 7:53 pm    Post subject: Reply with quote

Code:
nice -n0 yourProgram

for renice a running program, know the pid and use
Code:
renice
for negative nice values, you must be root!
_________________
-- erol
Back to top
View user's profile Send private message
ewg
n00b
n00b


Joined: 02 Aug 2005
Posts: 28

PostPosted: Mon Aug 08, 2005 8:21 pm    Post subject: Reply with quote

Yes, I know, but this is no solution. I want to specify the initial nice values of jobs started by atd.
Preceding scheduled commands with nice does not work, since atd overrides this. So, how do I make atd start commands with nice 0?
Back to top
View user's profile Send private message
limn
l33t
l33t


Joined: 13 May 2005
Posts: 997

PostPosted: Mon Aug 08, 2005 8:48 pm    Post subject: Reply with quote

You would have to modify the code. It is written to have a minimum value of 2.
Perhaps at's history as a security problem is the reason for this.
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Mon Aug 08, 2005 10:15 pm    Post subject: Reply with quote

and if you renice afterwards? does at checks its current niceness?
_________________
-- erol
Back to top
View user's profile Send private message
ewg
n00b
n00b


Joined: 02 Aug 2005
Posts: 28

PostPosted: Mon Aug 08, 2005 10:19 pm    Post subject: Reply with quote

renice works. However, I use at because I am not at the computer when the job is started. So I can't renice it.
Back to top
View user's profile Send private message
ekutay
l33t
l33t


Joined: 30 Mar 2005
Posts: 636
Location: Berlin

PostPosted: Mon Aug 08, 2005 10:58 pm    Post subject: Reply with quote

you could add a cron job, renicing all at jobs. :)
Code:
for i in $( ps -C atd --format pid --no-header ) ; do renice -2 $i; done
maybe a patch as suggested or using cron instead generally is better if the priority is really important.
_________________
-- erol
Back to top
View user's profile Send private message
gentsquash
l33t
l33t


Joined: 03 Nov 2004
Posts: 753
Location: Still a Gentoo beginner.

PostPosted: Tue Aug 09, 2005 8:04 pm    Post subject: Reply with quote

(To O.P.) Is it good enough to put the nice within each line of
the at cmd? I.e, when at prompts for a cmd, type, e.g,
Code:
% at 2:48
warning: commands will be executed using /bin/sh

at>  nice -n 0     emerge kde-meta
at>  nice -n 0     /usr/bin/updatedb
at>  nice -n 0     /usr/sbin/eupdatedb

[Alternatively, I suppose one could find where at stores its cmd
files, and then one could run a script that puts a "nice -n 0" in
front of each line. This doesn't sound robust to me, however.]

_________________
Your thread resolved? Putting [SOLVED] in its title helps all Gentooers. (Button "edit" , first post)
Prof. Jonathan LF King, Mathematics dept., University of Florida
Back to top
View user's profile Send private message
maacruz
n00b
n00b


Joined: 05 Dec 2010
Posts: 1

PostPosted: Sun Dec 05, 2010 2:35 pm    Post subject: [SOLVED] how to set nice value of at jobs? Reply with quote

I had the same problem so I resorted to creating a new set of high niceness queues, from 0 (0 niceness) to 9 (-18 niceness).
Apply this patch to get the same:
Code:

diff -ruN at-3.1.8/at.c at-3.1.8-1/at.c
--- at-3.1.8/at.c       2002-01-18 05:15:27.000000000 +0100
+++ at-3.1.8-1/at.c     2010-12-05 14:39:17.000000000 +0100
@@ -758,7 +758,7 @@
                usage();

            atqueue = queue = *optarg;
-           if (!(islower(queue) || isupper(queue)) & (queue != '='))
+           if (!(islower(queue) || isupper(queue) || isdigit(queue)) & (queue != '='))
                usage();

            queue_set = 1;
diff -ruN at-3.1.8/atd.c at-3.1.8-1/atd.c
--- at-3.1.8/atd.c      2002-01-18 05:15:27.000000000 +0100
+++ at-3.1.8-1/atd.c    2010-12-05 14:46:03.000000000 +0100
@@ -383,7 +383,10 @@

        PRIV_START

-           nice((tolower((int) queue) - 'a' + 1) * 2);
+           if (isdigit(queue))
+               nice(('0' - (int) queue) * 2);
+           else
+               nice((tolower((int) queue) - 'a' + 1) * 2);

            if (initgroups(pentry->pw_name, pentry->pw_gid))
                perr("Cannot delete saved userids");
@@ -546,7 +549,7 @@
        /* Skip any other file types which may have been invented in
         * the meantime.
         */
-       if (!(isupper(queue) || islower(queue))) {
+       if (!(isupper(queue) || islower(queue) || isdigit(queue))) {
            continue;
        }
        /* Is the file already locked?
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Dec 06, 2010 6:04 pm    Post subject: Reply with quote

Just curious: why do these need to be nice=0?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum