dont use run-parts, wait for network via ping
This commit is contained in:
parent
6faaf54183
commit
46e8c23466
|
@ -1,15 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prevent *.sh from returning itself if there are no matches
|
||||
shopt -s nullglob
|
||||
|
||||
# Run every per-once script
|
||||
run-parts --regex '.*\.sh$' /boot/per-once.d | logger -s -t run-per-once
|
||||
exec 1> >(logger -s -t $(basename $0)) 2>&1
|
||||
|
||||
# Rename every per-once script
|
||||
for f in /boot/per-once.d/*.sh; do
|
||||
mv $f $(dirname $f)/$(basename $f .sh).$(date +%F@%H.%M.%S)
|
||||
echo "waiting for network to come up..."
|
||||
|
||||
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
|
||||
|
||||
# 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