#!/bin/bash echo $(date) > /tmp/myarchlikeinit.log if ! ip a | grep '^ *inet ' | grep -vF 127.0.0.1; then cat <<'eof' We don't have an ipv4 address. Maybe arch doesn't do that for us, or we are probably using an ethernet port which is not the 1st one, so we haven't automatically done dhcpcd, so let's do it on whatever interface has a carrier eof for f in /sys/class/net/*; do if [[ `cat $f/carrier` == 1 ]]; then echo $0: running: dhcpcd ${f##*/} dhcpcd ${f##*/} break fi done fi systemctl start sshd