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?

ciliou
  • 81

4 Answers4

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.

ciliou
  • 81
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).

Asclepius
  • 426
Wesley Baugh
  • 3,138
  • 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 06 '18 at 15:17
  • 1
    @lgeorget I have added an answer which uses systemctl edit to override ExecStart into /etc/systemd/. It builds upon this answer. – Asclepius Feb 28 '22 at 04:43
2

This builds upon the answer by Wesley B.. It applies if using systemctl. Instead of updating the service configuration directly, an override can be defined for it. It is better to do it this way because the OS can otherwise replace the service configuration at any time. This answer was tested with Ubuntu 21.10.

  1. Run sudo systemctl edit atd and insert:
[Service]
ExecStart=
ExecStart=/usr/sbin/atd -f -l 3.0 -b 5

Above, the line which is just ExecStart= with no value is necessary to nullify the old value. In the next line, set the values of -l and -b as required, referring to its man page.

This writes the above lines to /etc/systemd/system/atd.service.d/override.conf. If this file is added without systemctl edit, then sudo systemctl daemon-reload may have to be run.

  1. Run sudo systemctl restart atd.

  2. Verify the status:

systemctl status atd
ps aux | grep [a]td

These should show the service and process status, both with the customized args.

Asclepius
  • 426
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)

Matija Nalis
  • 3,111
  • 1
  • 14
  • 27
  • 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