slitaz-base-files rev 331
rootfs/etc/init.d/rc.functions: add cmdline_option()
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Mon Sep 11 23:14:30 2017 +0300 (2017-09-11) |
parents | 65248d132cd2 |
children | b9ee195f7a0a |
files | rootfs/etc/init.d/rc.functions |
line diff
1.1 --- a/rootfs/etc/init.d/rc.functions Sun Jul 23 13:51:37 2017 +0200 1.2 +++ b/rootfs/etc/init.d/rc.functions Mon Sep 11 23:14:30 2017 +0300 1.3 @@ -5,15 +5,24 @@ 1.4 . /lib/libtaz.sh 1.5 1.6 # Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON 1.7 -active_pidfile() 1.8 -{ 1.9 +active_pidfile() { 1.10 if [ ! -e $1 ]; then 1.11 return 1 1.12 elif grep -qs "Name:.$(basename $2)$" \ 1.13 - /proc/$(sed 's/[^0-9]//g' < $1 | head -n 1)/status ; then 1.14 + /proc/$(sed 's/[^0-9]//g;q' $1)/status; then 1.15 return 0 1.16 else 1.17 rm -f $1 1.18 return 2 1.19 fi 1.20 } 1.21 + 1.22 +# Get specified cmdline option value 1.23 +cmdline_option() { 1.24 + local opt 1.25 + for opt in $(cat /proc/cmdline); do 1.26 + case $opt in 1.27 + $1=*) echo ${opt#$1=};; 1.28 + esac 1.29 + done 1.30 +}