From 4d45ab4858909eb694ae85a0f157bd493b8f3ba7 Mon Sep 17 00:00:00 2001 From: lemniskett Date: Wed, 13 Jan 2021 00:09:27 +0700 Subject: [PATCH] Add delay option in services. --- archboxinit.bash | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/archboxinit.bash b/archboxinit.bash index 198fa80..fc748e3 100644 --- a/archboxinit.bash +++ b/archboxinit.bash @@ -37,8 +37,16 @@ case $1 in mkdir -p $CHROOT/$i rbind $i done + msg "Starting services" for j in ${SERVICES[@]}; do - chroot $CHROOT /bin/su -c "/usr/local/bin/archboxctl exec $j" > /dev/null 2>&1 + if [[ $j = *:* ]]; then + delay=$(echo $j | sed 's/.*://') + service=$(echo $j | sed 's/:.*//') + chroot $CHROOT /bin/su -c "/usr/local/bin/archboxctl exec $service" > /dev/null 2>&1 & + sleep $delay + else + chroot $CHROOT /bin/su -c "/usr/local/bin/archboxctl exec $j" > /dev/null 2>&1 & + fi done exit 0 ;;