Files
SimpleLinux/rootfs/etc/init.d/funcs/init-funcs
T
2024-09-12 15:12:32 +07:00

45 lines
1.0 KiB
Bash

#!/bin/sh
#--- import colors ---
. /etc/init.d/funcs/colors.sh
#---------------------
#---------------------- rc function to poweron or poweroff ------------
rc() {
if [ -d /etc/rc.d ] && [ $0 == "/etc/init.d/rcK" ]; then
for i in $(ls -r /etc/rc.d); do
/etc/rc.d/$i stop
done
return 1
fi
for i in /etc/rc.d/??*; do
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
$i start
;;
esac
done
sleep 1
# clear
return 1
}
#----------------------------------------------------------------------
#---------- check status function -----------
check() {
if [ $1 -ne 0 ]; then
printf "$BBLUE**$BRED ERROR: $2\n$RESET"
return
fi
printf "$BBLUE**$BGREEN SUCCESS: $2\n$RESET"
}
#--------------------------------------------