Giter Site home page Giter Site logo

Comments (7)

Areso avatar Areso commented on July 21, 2024
ArchLinux: using systemd (since 2012.10.06)
CentOS6.4 ami-52009e3b: using upstart
CentOS7 ami-96a818fe: using systemd
Debian 6 ami-80e915e9: using sysv-init
Debian 7.5 ami-2c886c44: using sysv-init
Debian 7.6 GCE container-vm: using sysv-init
RHEL 6.5 ami-8d756fe4: using upstart
SLES 11 ami-e8084981: using sysv-init
Ubuntu 10.04 ami-6b350a02: using upstart
Ubuntu 12.04 ami-b08b6cd8: using upstart
Ubuntu 14.04 ami-a427efcc: using upstart
Ubuntu 14.10 and younger: using systemd
AWS linux 2014.3.2 ami-7c807d14: using upstart
Fedora 19 ami-f525389c: using systemd
Fedora 20 ami-21362b48: using systemd

from python-parental-control.

Areso avatar Areso commented on July 21, 2024
You can tell upstart from:

[[ `/sbin/init --version` =~ upstart ]] && echo yes || echo no

You can tell systemd from:

[[ `systemctl` =~ -\.mount ]] && echo yes || echo no

You can tell sys-v init from:

[[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]] && echo yes

from python-parental-control.

Areso avatar Areso commented on July 21, 2024

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

from python-parental-control.

Areso avatar Areso commented on July 21, 2024

#!/bin/sh
if [ command -v systemctl >/dev/null ]
then
systemctl service start
else
/etc/init.d/service start
fi

from python-parental-control.

Areso avatar Areso commented on July 21, 2024

$ ps -eaf|grep '[u]pstart'
$ ps -eaf|grep '[s]ystemd'

$ sudo init --version
$ sudo systemctl --version (unsure)

from python-parental-control.

Areso avatar Areso commented on July 21, 2024

strings /sbin/init | grep -q "/lib/systemd" && echo SYSTEMD
strings /sbin/init | grep -q "sysvinit" && echo SYSVINIT
strings /sbin/init | grep -q "upstart" && echo UPSTART

from python-parental-control.

Areso avatar Areso commented on July 21, 2024

/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate

gnome-session-quit --power-off --force --no-prompt

from python-parental-control.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.