Server IP : 85.214.239.14 / Your IP : 18.116.85.96 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /etc/init.d/ |
Upload File : |
#!/bin/sh ### BEGIN INIT INFO # Provides: brightness # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # Short-Description: Save and restore brightness level between restarts. # Description: This script saves the brightness level between restarts. # It is called from the boot, halt and reboot scripts. ### END INIT INFO readonly SAVEFILE_PREFIX=/var/lib/initscripts/brightness . /lib/init/vars.sh . /lib/lsb/init-functions do_invoke() { local rv=0 rc # ACPI (without explicit label) do_$1 '' \ /sys/class/backlight/acpi_video0/brightness \ /sys/class/backlight/acpi_video0/max_brightness rc=$? test $rc -lt $rv || rv=$rc # Intel do_$1 intel \ /sys/class/backlight/intel_backlight/brightness \ /sys/class/backlight/intel_backlight/max_brightness rc=$? test $rc -lt $rv || rv=$rc # could insert others using the same scheme here return $rv } do_status() { local label=$1 knob=$2 max=$3 file=$SAVEFILE_PREFIX${1:+.$1} test -e "$knob" || return 0 MSG="Current${label:+ $label} brightness level is $(cat "$knob")" if test -f "$file"; then log_success_msg "${MSG}, saved value is $(cat "$file")" return 0 fi log_failure_msg "${MSG}, there is no saved value" return 4 } do_start() { local label=$1 knob=$2 max=$3 file=$SAVEFILE_PREFIX${1:+.$1} test -e "$knob" || return 0 test x"$VERBOSE" = x"no" || \ log_action_begin_msg Initialising $label brightness level if test -f "$file"; then cat "$file" >"$knob" else cat "$max" >"$knob" fi local rv=$? test x"$VERBOSE" = x"no" || log_action_end_msg $rv return $rv } do_stop() { local label=$1 knob=$2 max=$3 file=$SAVEFILE_PREFIX${1:+.$1} test -e "$knob" || return 0 test x"$VERBOSE" = x"no" || \ log_action_begin_msg Saving $label brightness level cat "$knob" >"$file" local rv=$? test x"$VERBOSE" = x"no" || log_action_end_msg $rv return $rv } case $1 in (start|restart|reload|force-reload) do_invoke start ;; (stop) do_invoke stop ;; (status) do_invoke status ;; (*) echo >&2 "Usage: $0 {start|stop|restart|reload|force-reload|status}" exit 3 ;; esac