source: systemd-units/blfs/services/dhcpcd@ be67218

systemd-11177
Last change on this file since be67218 was be67218, checked in by Krejzi <krejzi@…>, 10 years ago

Merge more Christopher's work. Import systemd units.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/systemd@13507 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 1.7 KB
Line 
1#!/bin/bash
2# Begin services/dhcpcd
3
4# Origianlly dased upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up}
5# Rewritten by Nathan Coulson <nathan@linuxfromscratch.org>
6# Adapted for dhcpcd by DJ Lucas <dj@linuxfromscratch.org>
7# Update for LFS 7.0 by Bruce Dubbs <bdubbs@linuxfromscratch,org>
8
9# Call with: IFCONFIG=<filename> /lib/services/dhcpcd <IFACE> <up | down>
10
11#$LastChangedBy: bdubbs $
12#$Date: 2012-04-09 21:48:51 +0200 (Mon, 09 Apr 2012) $
13
14. /lib/lsb/init-functions
15. $IFCONFIG
16
17pidfile="/var/run/dhcpcd-$1.pid"
18
19case "$2" in
20 up)
21 # Cosmetic output not needed for multiple services
22 if ! $(echo ${SERVICE} | grep -q " "); then
23 log_info_msg2 "\n" # Terminate the previous message
24 fi
25
26 log_info_msg "Starting dhcpcd on the $1 interface..."
27
28 # Test to see if there is a stale pid file
29 if [ -f "$pidfile" ]; then
30 ps `cat "$pidfile"` | grep dhcpcd > /dev/null
31
32 if [ $? != 0 ]; then
33 rm -f /var/run/dhcpcd-$1.pid > /dev/null
34
35 else
36 log_warning_msg "dhcpcd is already running!"
37 exit 2
38 fi
39 fi
40
41 /sbin/dhcpcd $1 $DHCP_START
42 evaluate_retval
43 ;;
44
45 down)
46 log_info_msg "Stopping dhcpcd on the $1 interface..."
47
48 if [ -z "$DHCP_STOP" ]; then
49 killproc -p "${pidfile}" /sbin/dhcpcd
50
51 else
52 /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null
53
54 if [ "$?" -eq 1 ]; then
55 log_warning_msg "dhcpcd not running!"
56 exit 2
57 fi
58 fi
59
60 evaluate_retval
61 ;;
62
63 *)
64 echo "Usage: $0 [interface] {up|down}"
65 exit 1
66 ;;
67esac
68
69# End services/dhcpcd
Note: See TracBrowser for help on using the repository browser.