6

I am launching non interactive jobs using batch, and I would like to increase the load limiting factor in order to use all 8 of my cores. I am on Ubuntu 16.04 LTS.

From what I understand, batch uses atd to do the jobs. Jobs start when the load factor goes under a threshold, called the load limiting factor. It is said in the man of atd that we can change this factor using the -l option.

My question: how can I use this atd -l XX option? When I type, for instance, atd -l 7.2 before batch, it doesn't seem to be changing anything.

What I have found so far:

It seems that it can be introduced in the /etc/init.d/atd, but I do not know where. I have never changed such files.

So, how can I change the load limiting factor used by the batch command?

2

Found a solution:

  • Create a file: /etc/init/atd.override
  • Add a line exec atd -l 7.2
  • Then sudo service atd restart

It has to do with how the 'Upstart init daemon' works. Explanations there: http://linux.die.net/man/5/init If the file /etc/init/atd.override already exists with an line starting with exec, edit this line.

3
2

Edit /lib/systemd/system/atd.service on Ubuntu 16.04 / systemd.

After appending -l «load avg» to the ExecStart:

$ cat /lib/systemd/system/atd.service 
[Unit]
Description=Deferred execution scheduler
Documentation=man:atd(8)

[Service]
ExecStart=/usr/sbin/atd -f -l 7.2
IgnoreSIGPIPE=false

[Install]
WantedBy=multi-user.targe

you'll see a message when running systemctl status atd or (service atd status):

Warning: atd.service changed on disk. Run 'systemctl daemon-reload' to reload units.

Running that command gets rid of the warning, but to actually pick up the change the service needs to be restarted by systemctl restart atd (service atd restart).

1
  • Nice answer! One point though: instead of editing units in /lib/systemd..., it's recommended to copy the files over to /etc/systemd/... and edit the copy (the unit in /etc/systemd will override the unit in /lib/systemd).
    – lgeorget
    Sep 6 '18 at 15:17
0

I don't have Ubuntu 16.04 LTS nearby, but on Debian-based system /etc/init.d/atd will usually say something like:

case "$1" in
  start)
        log_daemon_msg "Starting deferred execution scheduler" "atd"
        start_daemon -p $PIDFILE $DAEMON -l 7
        log_end_msg $?

note where I added -l 7 part. Then you need to restart with /etc/init.d/atd restart, and check with ps auxwww|grep atd if it was accepted.

note that sometimes you'll have /etc/default/atd which is the easier way (and better, as your changes won't be silently wiped on next upgrade)

1
  • 1
    The file /etc/init.d/atd does not have something like that. Your answer helps me realize that editing this file was not the solution for Ubuntu, at least from version 12.04 LTS. I finally found a solution, cf the answer.
    – ciliou
    Aug 31 '16 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.