Last active
July 12, 2018 11:03
-
-
Save wizofe/cd918acce1877b722899cdb82a881ed7 to your computer and use it in GitHub Desktop.
Start systemd/init level services sequentially
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Start all system services sequentially | |
wants=$(systemctl show -p Wants multi-user.target | sed 's/^Wants=//' | tr ' ' '\n' | sort) | |
log=/var/tmp/multi-user-steps-$(date +%Y%m%d-%H%M%S) | |
log () { | |
echo "$* ..." | tee -a "$log" | |
sync | |
"$@" | |
ret=$? | |
echo "$* -> $ret" | tee -a "$log" | |
sync | |
return $ret | |
} | |
# systemd services | |
for service in $wants; do | |
log systemctl start $service | |
sleep 2 | |
done | |
# up start services | |
for conf in /etc/init/*.conf; do | |
service=${conf##*/}; service=${service%.conf} | |
log service ${service} start | |
sleep 2 | |
done | |
# init level 3 services | |
for service in /etc/rc3.d/S*; do | |
log ${service} start | |
sleep 2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment