Skip to content

Instantly share code, notes, and snippets.

@likai24
Created June 27, 2016 17:23
Show Gist options
  • Save likai24/266ceaaa2400d015ea12abe2a17732cf to your computer and use it in GitHub Desktop.
Save likai24/266ceaaa2400d015ea12abe2a17732cf to your computer and use it in GitHub Desktop.
检查系统的启动命令
#!/bin/bash
# from http://unix.stackexchange.com/questions/18209/detect-init-system-using-the-shell
if [[ `/sbin/init --version` =~ upstart ]]; then echo using upstart;
elif [[ `systemctl` =~ -\.mount ]]; then echo using systemd;
elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then echo using sysv-init;
else echo cannot tell; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment