1. service方式
service其实管理的是脚本,有一些需要我们自己编写,脚本位置在/etc/inin.d/
root@ubuntu:/# cd /etc/init.d/ root@ubuntu:/etc/init.d# ls acpid checkfs.sh docker kmod networking rc.local single umountroot alsa-utils checkroot-bootclean.sh grub-common lightdm network-manager rcS skeleton unattended-upgrades anacron checkroot.sh halt mountall-bootclean.sh ondemand README speech-dispatcher urandom apparmor console-setup hostname.sh mountall.sh open-vm-tools reboot supervisor uuidd apport cron hwclock.sh mountdevsubfs.sh plymouth resolvconf thermald whoopsie avahi-daemon cups irqbalance mountkernfs.sh plymouth-log rsync udev x11-common bluetooth cups-browsed kerneloops mountnfs-bootclean.sh pppd-dns rsyslog ufw bootmisc.sh dbus keyboard-setup mountnfs.sh procps saned umountfs brltty dns-clean killprocs mysql rc sendsigs umountnfs.sh
例如:我们想查看 docker的状态,service docker status
需求:在桌面写一个test_service.py,让 service test_service start /service test_service stop / service test_service restart / service test_service status 都可以执行
# TODO
# TODO