dont use run-parts, wait for network via ping
This commit is contained in:
parent
6faaf54183
commit
46e8c23466
@ -1,15 +1,28 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Prevent *.sh from returning itself if there are no matches
|
# Prevent *.sh from returning itself if there are no matches
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
# Run every per-once script
|
exec 1> >(logger -s -t $(basename $0)) 2>&1
|
||||||
run-parts --regex '.*\.sh$' /boot/per-once.d | logger -s -t run-per-once
|
|
||||||
|
|
||||||
# Rename every per-once script
|
echo "waiting for network to come up..."
|
||||||
for f in /boot/per-once.d/*.sh; do
|
|
||||||
mv $f $(dirname $f)/$(basename $f .sh).$(date +%F@%H.%M.%S)
|
until ping -c1 www.google.com >/dev/null 2>&1; do :; done
|
||||||
|
|
||||||
|
echo "network is now up, running scripts"
|
||||||
|
|
||||||
|
# Run every per-once script
|
||||||
|
for FN in /boot/per-once.d/*.sh ; do
|
||||||
|
echo "running '$FN'"
|
||||||
|
bash "$FN" && \
|
||||||
|
echo "renaming $FN" && \
|
||||||
|
mv $FN $(dirname $FN)/$(basename $FN .sh).$(date +%F.%H.%M.%S)
|
||||||
done
|
done
|
||||||
|
|
||||||
# Run every per-boot script
|
# Run every per-boot script
|
||||||
run-parts --regex '.*\.sh$' /boot/per-boot.d | logger -s -t run-per-boot
|
for FN in /boot/per-boot.d/*.sh ; do
|
||||||
|
echo "running '$FN'"
|
||||||
|
bash "$FN"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user