Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2012 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
Bertrand SIMONNET | 01ca1fb | 2014-03-04 10:06:26 -0800 | [diff] [blame] | 16 | |
| 17 | description "System software update service" |
| 18 | author "chromium-os-dev@chromium.org" |
| 19 | |
| 20 | # N.B. The chromeos-factoryinstall ebuild edits the 'start on' line so as |
| 21 | # to disable update_engine in factory images. Do not change this without |
| 22 | # also updating that reference. |
| 23 | start on starting system-services |
| 24 | stop on stopping system-services |
Amin Hassani | 6479359 | 2018-04-20 14:28:12 -0700 | [diff] [blame] | 25 | # The default is 10 failures every 5 seconds, but even if we crash early, it is |
| 26 | # hard to catch that. So here we set the crash rate as 10 failures every 20 |
| 27 | # seconds which will include the default and more. |
Nicolas Norvez | 3d53cbc | 2019-05-10 15:02:07 -0700 | [diff] [blame] | 28 | respawn |
Amin Hassani | 6479359 | 2018-04-20 14:28:12 -0700 | [diff] [blame] | 29 | respawn limit 10 20 |
Bertrand SIMONNET | 01ca1fb | 2014-03-04 10:06:26 -0800 | [diff] [blame] | 30 | |
| 31 | expect fork |
| 32 | |
| 33 | # Runs the daemon at low/idle IO priority so that updates don't |
| 34 | # impact system responsiveness. |
| 35 | exec ionice -c3 update_engine |
| 36 | |
| 37 | # Put update_engine process in its own cgroup. |
| 38 | # Default cpu.shares is 1024. |
| 39 | post-start script |
Jie Jiang | 8055010 | 2020-09-02 13:00:36 +0900 | [diff] [blame] | 40 | pid=$(status | cut -f 4 -d ' ') |
| 41 | |
| 42 | cgroup_cpu_dir="/sys/fs/cgroup/cpu/${UPSTART_JOB}" |
| 43 | mkdir -p "${cgroup_cpu_dir}" |
| 44 | echo ${pid} > "${cgroup_cpu_dir}/tasks" |
| 45 | |
| 46 | # Assigns net_cls handle 1:1 to packets generated from update_engine. For |
| 47 | # routing and tagging purposes, that value will be redefined in |
| 48 | # patchpanel/routing_service.h . |
| 49 | cgroup_net_cls_dir="/sys/fs/cgroup/net_cls/${UPSTART_JOB}" |
| 50 | mkdir -p "${cgroup_net_cls_dir}" |
| 51 | echo ${pid} > "${cgroup_net_cls_dir}/tasks" |
| 52 | echo "0x10001" > "${cgroup_net_cls_dir}/net_cls.classid" |
Bertrand SIMONNET | 01ca1fb | 2014-03-04 10:06:26 -0800 | [diff] [blame] | 53 | end script |