Home | History | Annotate | Download | only in init
      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 #
     16 
     17 description     "System software update service"
     18 author          "chromium-os-dev (at] 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
     25 respawn
     26 
     27 expect fork
     28 
     29 # Runs the daemon at low/idle IO priority so that updates don't
     30 # impact system responsiveness.
     31 exec ionice -c3 update_engine
     32 
     33 # Put update_engine process in its own cgroup.
     34 # Default cpu.shares is 1024.
     35 post-start script
     36   cgroup_dir="/sys/fs/cgroup/cpu/${UPSTART_JOB}"
     37   mkdir -p "${cgroup_dir}"
     38   echo $(status | cut -f 4 -d ' ') > "${cgroup_dir}/tasks"
     39 end script
     40