{
 "systemd 與 systemctl 日常操作#1": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "cards": [
   {
    "title": "依序啟動",
    "points": [
     "相依順序",
     "掛載、網路"
    ]
   },
   {
    "title": "監控服務",
    "points": [
     "異常自動重啟"
    ]
   },
   {
    "title": "journald",
    "points": [
     "收集日誌"
    ]
   },
   {
    "title": "計時器",
    "points": [
     "取代部分 cron"
    ]
   },
   {
    "title": "cgroup",
    "points": [
     "停止時清乾淨"
    ]
   }
  ]
 },
 "systemd 與 systemctl 日常操作#2": {
  "type": "table",
  "head": [
   "副檔名",
   "用途"
  ],
  "rows": [
   [
    ".service",
    "服務(nginx、ssh)"
   ],
   [
    ".timer",
    "計時器"
   ],
   [
    ".target",
    "單元的集合"
   ],
   [
    ".mount .socket .path",
    "其他類型單元"
   ]
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ]
 },
 "systemd 與 systemctl 日常操作#3": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3
  ],
  "cards": [
   {
    "title": "Loaded",
    "points": [
     "單元檔位置",
     "enabled / disabled"
    ]
   },
   {
    "title": "Active",
    "points": [
     "active (running)",
     "inactive (dead)",
     "failed"
    ]
   },
   {
    "title": "Main PID",
    "points": [
     "主程序編號"
    ]
   }
  ]
 },
 "systemd 與 systemctl 日常操作#5": {
  "type": "cards",
  "reveal": [
   0,
   2,
   2
  ],
  "cards": [
   {
    "title": "現在",
    "points": [
     "start",
     "stop",
     "restart",
     "reload"
    ]
   },
   {
    "title": "下次開機",
    "points": [
     "enable",
     "disable"
    ]
   }
  ]
 },
 "systemd 與 systemctl 日常操作#6": {
  "type": "table",
  "head": [
   "動作",
   "說明"
  ],
  "rows": [
   [
    "start",
    "現在啟動"
   ],
   [
    "stop",
    "現在停止"
   ],
   [
    "restart",
    "先停再啟,連線短暫中斷"
   ],
   [
    "reload",
    "重載設定,不中斷"
   ]
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ]
 },
 "開機流程與 target#1": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "nodes": [
   {
    "label": "UEFI / BIOS",
    "sub": "自我檢測",
    "color": 0
   },
   {
    "label": "GRUB",
    "sub": "載入核心",
    "color": 1
   },
   {
    "label": "核心",
    "sub": "initramfs",
    "color": 2
   },
   {
    "label": "systemd",
    "sub": "掛載、啟動服務",
    "color": 3,
    "kind": "end"
   }
  ]
 },
 "開機流程與 target#2": {
  "type": "table",
  "head": [
   "徵兆",
   "多半原因"
  ],
  "rows": [
   [
    "停在 GRUB 提示字元",
    "找不到設定或磁碟"
   ],
   [
    "kernel panic",
    "initramfs 或根分區"
   ],
   [
    "start job is running",
    "掛載或服務逾時"
   ],
   [
    "emergency mode",
    "檔案系統掛載失敗"
   ]
  ],
  "reveal": [
   0,
   0,
   1,
   2,
   3,
   4
  ]
 },
 "開機流程與 target#3": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "cards": [
   {
    "title": "multi-user",
    "points": [
     "文字模式",
     "網路已啟用",
     "伺服器常用"
    ]
   },
   {
    "title": "graphical",
    "points": [
     "再加圖形介面",
     "桌面預設"
    ]
   },
   {
    "title": "rescue",
    "points": [
     "單人救援",
     "root shell"
    ]
   },
   {
    "title": "emergency",
    "points": [
     "最小環境",
     "根目錄唯讀"
    ]
   }
  ]
 },
 "撰寫自己的 service 單元#3": {
  "type": "cards",
  "reveal": [
   0,
   0,
   1,
   1,
   1,
   2
  ],
  "cards": [
   {
    "title": "[Unit]",
    "points": [
     "Description 說明",
     "After=network.target"
    ]
   },
   {
    "title": "[Service]",
    "points": [
     "說明服務怎麼跑"
    ]
   }
  ]
 },
 "撰寫自己的 service 單元#4": {
  "type": "table",
  "head": [
   "設定",
   "說明"
  ],
  "rows": [
   [
    "Type=simple",
    "最基本的類型"
   ],
   [
    "User",
    "執行的使用者"
   ],
   [
    "Group",
    "執行的群組"
   ],
   [
    "WorkingDirectory",
    "工作目錄"
   ],
   [
    "ExecStart",
    "要執行的指令"
   ],
   [
    "Restart=on-failure",
    "異常結束自動重啟"
   ]
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5,
   6
  ]
 },
 "撰寫自己的 service 單元#6": {
  "type": "table",
  "head": [
   "Type",
   "說明"
  ],
  "rows": [
   [
    "simple",
    "預設,ExecStart 就是主程序"
   ],
   [
    "forking",
    "程式自己跑到背景"
   ],
   [
    "oneshot",
    "執行完就結束"
   ],
   [
    "notify",
    "準備好時通知 systemd"
   ]
  ],
  "reveal": [
   0,
   0,
   0,
   4,
   4
  ]
 },
 "服務排錯與 journalctl 入門#1": {
  "type": "flow",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "nodes": [
   {
    "label": "看狀態",
    "sub": "status",
    "color": 0
   },
   {
    "label": "看日誌",
    "sub": "journalctl -u",
    "color": 1
   },
   {
    "label": "驗證語法",
    "sub": "nginx -t",
    "color": 2
   },
   {
    "label": "查環境",
    "sub": "權限、路徑、埠號",
    "color": 3
   },
   {
    "label": "restart",
    "sub": "再確認狀態",
    "color": 4,
    "kind": "end"
   }
  ],
  "layout": "snake"
 },
 "服務排錯與 journalctl 入門#3": {
  "type": "table",
  "head": [
   "選項",
   "效果"
  ],
  "rows": [
   [
    "-u 服務",
    "全部日誌,舊到新"
   ],
   [
    "-u 服務 -n 50",
    "最後五十行"
   ],
   [
    "-u 服務 -f",
    "即時追蹤"
   ]
  ],
  "reveal": [
   0,
   1,
   2,
   3
  ]
 },
 "服務排錯與 journalctl 入門#6": {
  "type": "table",
  "head": [
   "結束代碼",
   "意思"
  ],
  "rows": [
   [
    "203 / EXEC",
    "ExecStart 找不到或不能執行"
   ],
   [
    "200",
    "工作目錄不存在"
   ],
   [
    "217",
    "User 帳號不存在"
   ],
   [
    "1",
    "程式自己回傳錯誤"
   ],
   [
    "SEGV / ABRT",
    "程式當掉"
   ]
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ]
 }
}