📌
ibook
  • README
  • cheatsheet
    • bash
      • builtin
      • syntactic sugar
      • cmd
      • havefun
    • text-processing
      • awk
      • sed
      • html
      • json
      • regex
      • unicode
    • osx
    • curl
    • tricky
    • widget
    • proxy
    • colors
    • math
    • media
    • ssl
      • cheatsheet
      • keys
      • keystore
      • verification
      • server
      • client
      • tricky
    • windows
      • powershell
      • choco
      • wsl
      • wt
      • shortcut
      • clsid
      • env
      • shell:folder
  • vim
    • nvim
    • install
    • color
    • plugins
      • usage
      • other plugins
      • deprecated
    • tricky
    • viml
    • windows
    • troubleshooting
  • devops
    • admin tools
    • ssh
    • git
      • config
      • alias
      • submodule
      • eol
      • example
      • gerrit
        • gerrit API
      • github
      • troubleshooting
      • tricky
      • statistics
    • pre-commit
    • release-tools
    • tmux
      • cheatsheet
    • ansible
    • vault
    • artifactory
      • api
      • cli
      • aql
      • nginx cert
    • klocwork
      • kwadmin
      • kwserver
      • api
      • q&a
    • elk
    • mongodb
    • android
    • mobile
  • jenkins
    • config
      • windows
    • appearance
    • troubleshooting
    • jenkinsfile
      • utility
      • parallel
      • build
      • envvar
      • properties
      • trigger
      • node
    • script
      • job
      • build
      • stage
      • agent
      • security & authorization
      • exception
      • monitor
      • tricky
    • api
      • blueocean
    • cli
    • plugins
      • kubernetes
      • docker
      • shared-libs
      • lockable-resource
      • ansicolor
      • badge
      • groovy-postbuild
      • simple-theme
      • customizable-header
      • artifactory
      • jira-steps
      • job-dsl
      • build-timeline
      • crumbIssuer
      • coverage
      • uno-choice
      • tricky
  • virtualization
    • kubernetes
      • init
        • kubespray
        • kubeadm
          • environment
          • crio v1.30.4
          • docker v1.15.3
          • HA
        • addons
        • etcd
      • kubectl
        • pod
        • deploy
        • replicasets
        • namespace
        • secrets
      • node
      • certificates
      • events
      • kubeconfig
      • kubelet
      • troubleshooting
      • cheatsheet
      • auth
      • api
      • tools
        • monitor
        • helm
        • network
        • minikube
    • docker
      • run & exec
      • voume
      • remove
      • show info
      • dockerfile
      • dockerd
      • tricky
      • troubleshooting
      • windows
    • crio
    • podman
  • ai
    • prompt
  • osx
    • apps
      • init
      • brew
    • defaults
    • system
    • network
    • script
    • tricky
  • linux
    • devenv
    • util
      • time & date
      • output formatting
      • params
      • tricky
    • nutshell
    • disk
    • network
    • troubleshooting
    • system
      • apt/yum/snap
      • authorization
      • apps
      • x11
    • ubuntu
      • systemctl
      • x
    • rpi
  • programming
    • groovy
    • python
      • config
      • basic
      • list
      • pip
      • q&a
    • others
    • archive
      • angular
      • maven
      • mysql
        • installation
        • logs
      • ruby
        • rubyInstallationQ&A
  • tools
    • fonts
    • html & css
    • Jira & Confluence
    • node & npm
      • gitbook
      • hexo
      • github.page
      • code themes
    • app
      • microsoft office
      • vscode
      • virtualbox
      • iterm2
      • browser
      • skype
      • teamviewer
      • others
  • quotes
  • english
Powered by GitBook
On this page
  • needrestart
  • dpkg
  • service
  • ubuntu 17.10 bootup settings

Was this helpful?

  1. linux
  2. ubuntu

systemctl

PreviousubuntuNextx

Last updated 1 year ago

Was this helpful?

[!NOTE|label:references:]

needrestart

[!NOTE]

$ needrestart -r i -k
Scanning linux images...

Pending kernel upgrade!

Running kernel version:
  6.5.0-14-generic

  Diagnostics:
    The currently running kernel has an ABI compatible upgrade pending.

    Restarting the system to load the new kernel will not be handled automatically, so you should consider
    rebooting. [Return]

dpkg

$ sudo dpkg --list

# reconfiguring the dpkg package
$ sudo dpkg --configure -a

service

[!NOTE|label:references:]

list all

$ sudo service --status-all
$ sudo service --status-all | grep '\[ + \]'
$ sudo service --status-all | grep '\[ - \]'

# list all running services on Ubuntu
$ sudo systemctl list-units
$ sudo systemctl list-units --state running
$ sudo service --status-all
 [ + ]  acpid
 [ - ]  alsa-utils
 [ - ]  anacron
 [ + ]  apparmor
 [ + ]  apport
 [ + ]  avahi-daemon
 [ - ]  bluetooth
 [ - ]  console-setup.sh
 [ + ]  cron
 [ + ]  cups
 [ + ]  cups-browsed
 [ + ]  dbus
 [ + ]  gdm3
 [ - ]  grub-common
 [ - ]  hwclock.sh
 [ + ]  irqbalance
 [ + ]  kerneloops
 [ - ]  keyboard-setup.sh
 [ + ]  kmod
 [ - ]  lm-sensors
 [ - ]  lvm2
 [ - ]  lvm2-lvmpolld
 [ + ]  openvpn
 [ - ]  plymouth
 [ + ]  plymouth-log
 [ + ]  procps
 [ - ]  pulseaudio-enable-autospawn
 [ - ]  rsync
 [ - ]  saned
 [ - ]  speech-dispatcher
 [ - ]  spice-vdagent
 [ + ]  ssh
 [ + ]  sssd
 [ + ]  udev
 [ + ]  ufw
 [ + ]  unattended-upgrades
 [ - ]  uuidd
 [ - ]  whoopsie
 [ - ]  x11-common
 [ - ]  xrdp

ubuntu 17.10 bootup settings

create script

$ cat /usr/local/bin/do_route.sh
#!/usr/bin/env bash

# Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
# 0.0.0.0         192.168.10.1    0.0.0.0         UG    0      0        0 eno2
/sbin/route -n | grep "0\.0\.0\.0.*192\.168\.10\.1.*eno2" > /dev/null 2>&1
if [ $? != 0 ]; then
  sudo route add default gw 192.168.10.1
fi

## Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
## 0.0.0.0         130.147.180.65  0.0.0.0         UG    0      0        0 eno1
/sbin/route -n | grep "0\.0\.0\.0.*130\.147\.180\.65.*eno1" > /dev/null 2>&1
if [ $? == 0 ]; then
  sudo route delete -net 0.0.0.0 gw 130.147.180.65 netmask 0.0.0.0
fi

host="161.92.35.78 130.147.236.5 180.166.223.190 140.207.91.234 42.99.164.34 185.46.212.34"
for _h in ${host}; do
    sudo route add -host ${_h} gw 130.147.180.65
done

route="130.147.0.0 130.140.0.0 130.146.0.0 137.55.0.0 161.83.0.0 161.84.0.0 161.85.0.0 161.88.0.0 161.91.0.0 161.92.0.0 185.166.0.0"
for _r in ${route}; do
  sudo route add -net ${_r} netmask 255.255.0.0 eno1
done

touch /home/devops/hi-marslo

create service

$ ls -altrh /lib/systemd/system/do_route.service
-rwxr-xr-x 1 root root 140 Jan 15 22:08 /lib/systemd/system/do_route.service

$ cat /lib/systemd/system/do_route.service
[Unit]
Description=Add static route for two interface

[Service]
ExecStart=/usr/local/bin/do_route.sh

[Install]
WantedBy=multi-user.target
Alias=myroute.service

enable the service

$ sudo systemctl enable do_route.service
Created symlink /etc/systemd/system/multi-user.target.wants/do_route.service → /lib/systemd/system/do_route.service.
Created symlink /etc/systemd/system/myroute.service → /lib/systemd/system/do_route.service.

$ sudo systemctl start do_route.service

disable the service

$ sudo systemctl disable do_route.service
Removed /etc/systemd/system/myroute.service.
Removed /etc/systemd/system/multi-user.target.wants/do_route.service.

re-enable the service

$ sudo systemctl enable add_route.service
Created symlink /etc/systemd/system/marslo_route.service → /lib/systemd/system/add_route.service.
Created symlink /etc/systemd/system/multi-user.target.wants/add_route.service → /lib/systemd/system/add_route.service.

route FLags

  • U: Up: 表示此路由当前为启动状态

  • H: Host: 表示此网关为一主机

  • G: Gateway: 表示此网关为一路有

  • R: Reinstate Route: 使用动态路由重新初始化的路由

  • D: Dynamically: 此路由是动态性的写入

  • M: Modifed: 此路由是有路由守护程序或导向器动态修改

  • !: 关闭状态

provide and users with a graphical login prompt.

needrestart
dpkg
service
list all
ubuntu 17.10 bootup settings
How to automatically execute shell script at startup boot on systemd Linux
Using systemd to control the Docker daemon
systemd_service.5.manual
Linux route命令详解:查看和操作IP路由表
ubuntu配置静态路由及重启生效
Systemd的Unit文件; systemctl增加服务详细介绍
SystemdForUpstartUsers
How to disable IPv6 address on Ubuntu 22.04 LTS Jammy Jellyfish
liske/needrestart
How to Install Needrestart on Fedora 39, 38 Linux
Debian: unattended-upgrades + needrestart
UnattendedUpgrades
How to stop ubuntu pop-up "Daemons using outdated libraries" when using apt to install or update packages? [closed]
apt-get upgrade auto restart services
how we can see all running services Linux machine?
GDM
GNOME Display Manager
Display managers
X Window System
Wayland
Ubuntu18-22.04安装和干净卸载nvidia显卡驱动——超详细、最简单