| # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Automatically start p2p if content to be shared exists" |
| author "chromium-os-dev@chromium.org" |
| |
| # This job starts the p2p job if there is a non-zero number of .p2p |
| # files in the /var/cache/p2p directory. |
| |
| start on starting system-services |
| |
| script |
| P2P_DIR=/var/cache/p2p |
| NUM_P2P_FILES=$(ls -1 $P2P_DIR/*.p2p 2> /dev/null |wc -l) |
| if [ $NUM_P2P_FILES != 0 ]; then |
| initctl start p2p || true |
| fi |
| end script |