Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Side by Side Diff: laptop-mode-tools_1.52/usr/sbin/laptop_mode

Issue 1638015: add laptop-mode-tools config knob to control syslog facility (Closed)
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « laptop-mode-tools_1.52/etc/laptop-mode/laptop-mode.conf ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! /bin/sh 1 #! /bin/sh
2 # 2 #
3 # Script to start or stop laptop_mode, and to control various settings of the 3 # Script to start or stop laptop_mode, and to control various settings of the
4 # kernel, hardware etc. that influence power consumption. 4 # kernel, hardware etc. that influence power consumption.
5 # 5 #
6 # This script is a part of Laptop Mode Tools. If you are running a supported 6 # This script is a part of Laptop Mode Tools. If you are running a supported
7 # power management daemon, this script will be automatically called on power 7 # power management daemon, this script will be automatically called on power
8 # state change. 8 # state change.
9 # 9 #
10 # Configure laptop mode tools in /etc/laptop-mode/laptop-mode.conf, and in 10 # Configure laptop mode tools in /etc/laptop-mode/laptop-mode.conf, and in
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 AUTO_HIBERNATION_BATTERY_CHARGE_MAH=0 120 AUTO_HIBERNATION_BATTERY_CHARGE_MAH=0
121 AUTO_HIBERNATION_BATTERY_CHARGE_MWH=0 121 AUTO_HIBERNATION_BATTERY_CHARGE_MWH=0
122 MINIMUM_BATTERY_CHARGE_MAH=0 122 MINIMUM_BATTERY_CHARGE_MAH=0
123 MINIMUM_BATTERY_CHARGE_MWH=0 123 MINIMUM_BATTERY_CHARGE_MWH=0
124 ASSUME_SCSI_IS_SATA=1 124 ASSUME_SCSI_IS_SATA=1
125 CONTROL_BRIGHTNESS=0 125 CONTROL_BRIGHTNESS=0
126 BATT_BRIGHTNESS_COMMAND=false 126 BATT_BRIGHTNESS_COMMAND=false
127 LM_AC_BRIGHTNESS_COMMAND=false 127 LM_AC_BRIGHTNESS_COMMAND=false
128 NOLM_AC_BRIGHTNESS_COMMAND=false 128 NOLM_AC_BRIGHTNESS_COMMAND=false
129 LOG_TO_SYSLOG=1 129 LOG_TO_SYSLOG=1
130 SYSLOG_FACILITY=daemon
130 DEBUG=0 131 DEBUG=0
131 132
132 checkint () 133 checkint ()
133 { 134 {
134 # $1 arg should be the string/integer 135 # $1 arg should be the string/integer
135 # that you want to check for as an integer. 136 # that you want to check for as an integer.
136 echo $1 | grep "[^0-9]" > /dev/null 2>&1 137 echo $1 | grep "[^0-9]" > /dev/null 2>&1
137 138
138 return $?; 139 return $?;
139 # Returns 1 if it is an integer 140 # Returns 1 if it is an integer
140 } 141 }
141 142
142 # Function to handle logging 143 # Function to handle logging
143 LOGGER=`which logger`; 144 LOGGER=`which logger`;
144 145
145 log () 146 log ()
146 { 147 {
147 # $1 should be msg type 148 # $1 should be msg type
148 # $2 should be the real msg 149 # $2 should be the real msg
149 if [ x$LOG_TO_SYSLOG = x1 ]; then 150 if [ x$LOG_TO_SYSLOG = x1 ]; then
150 # NOTE: Add the check on $2 being empty, once you are confident 151 # NOTE: Add the check on $2 being empty, once you are confident
151 # that there aren't any bugs in logging. And no bugs in executing 152 # that there aren't any bugs in logging. And no bugs in executing
152 # modules and logging 153 # modules and logging
153 if [ -x $LOGGER -a "$1" != "STATUS" ]; then 154 if [ -x $LOGGER -a "$1" != "STATUS" ]; then
154 #if [ -z $2 ]; then 155 #if [ -z $2 ]; then
155 # continue 156 # continue
156 #elif [ "$1" = "MSG" ]; then 157 #elif [ "$1" = "MSG" ]; then
157 if [ "$1" = "MSG" ]; then 158 if [ "$1" = "MSG" ]; then
158 logger -p daemon.info -t laptop-mode "$2"; 159 logger -p $SYSLOG_FACILITY.info -t laptop-mode "$2";
159 elif [ "$1" = "ERR" ]; then 160 elif [ "$1" = "ERR" ]; then
160 logger -p daemon.err -t laptop-mode "$2"; 161 logger -p $SYSLOG_FACILITY.err -t laptop-mode "$2";
161 elif [ "$1" = "VERBOSE" ]; then 162 elif [ "$1" = "VERBOSE" ]; then
162 logger -p daemon.debug -t laptop-mode "$2"; 163 logger -p $SYSLOG_FACILITY.debug -t laptop-mode "$2";
163 else 164 else
164 logger -p daemon.notice -t laptop-mode "$2"; 165 logger -p $SYSLOG_FACILITY.notice -t laptop-mode "$2";
165 fi 166 fi
166 fi 167 fi
167 fi 168 fi
168 169
169 if [ "$1" = "VERBOSE" ]; then 170 if [ "$1" = "VERBOSE" ]; then
170 $LM_VERBOSE && echo "$2" >/dev/fd/2; 171 $LM_VERBOSE && echo "$2" >/dev/fd/2;
171 elif [ "$1" = "ERR" ]; then 172 elif [ "$1" = "ERR" ]; then
172 echo "$2" >/dev/fd/2; 173 echo "$2" >/dev/fd/2;
173 else 174 else
174 # Message of type MSG and STATUS can go to stdout. 175 # Message of type MSG and STATUS can go to stdout.
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 log "VERBOSE" "Module $SCRIPT is not executable." 1022 log "VERBOSE" "Module $SCRIPT is not executable."
1022 fi 1023 fi
1023 done 1024 done
1024 1025
1025 1026
1026 exit 0 1027 exit 0
1027 1028
1028 # This fi closes the if for "readconfig". If I would have indented this one 1029 # This fi closes the if for "readconfig". If I would have indented this one
1029 # I would have indented the whole file. :) 1030 # I would have indented the whole file. :)
1030 fi 1031 fi
OLDNEW
« no previous file with comments | « laptop-mode-tools_1.52/etc/laptop-mode/laptop-mode.conf ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698