[{"data":1,"prerenderedAt":3155},["ShallowReactive",2],{"/knowledge-base/systemd":3,"/knowledge-base/systemd-surround":3150},{"id":4,"title":5,"body":6,"category":3133,"contentType":3134,"date":3135,"description":3136,"extension":3137,"head":3138,"image":3139,"meta":3140,"navigation":62,"ogImage":3138,"path":3141,"readingTime":3142,"robots":3138,"schemaOrg":3138,"seo":3143,"sitemap":3144,"stem":3145,"tags":3146,"__hash__":3149},"knowledgeBase/knowledge-base/systemd.md","systemd Service Guide",{"type":7,"value":8,"toc":3085},"minimark",[9,19,134,170,173,177,196,205,207,211,235,249,251,255,272,280,282,286,302,310,312,316,347,368,370,374,384,389,450,454,536,540,597,601,710,714,759,763,910,914,951,955,989,993,1058,1062,1104,1106,1112,1116,1148,1152,1157,1169,1190,1195,1199,1203,1266,1273,1279,1354,1359,1377,1381,1443,1447,1505,1508,1553,1557,1644,1646,1650,1654,1686,1690,1696,1702,1745,1751,1783,1788,1820,1825,1833,1837,1842,1885,1962,1965,2009,2014,2056,2107,2112,2175,2179,2264,2266,2270,2274,2325,2331,2374,2382,2427,2431,2496,2500,2503,2570,2572,2576,2627,2632,2653,2660,2662,2666,2916,2918,2922,2927,2956,2961,3028,3033,3081],[10,11,13,14,18],"h2",{"id":12},"service-unit-file-etcsystemdsystemmyappservice","Service Unit File (",[15,16,17],"code",{},"/etc/systemd/system/myapp.service",")",[20,21,26],"pre",{"className":22,"code":23,"language":24,"meta":25,"style":25},"language-ini shiki shiki-themes github-light github-dark github-dark","[Unit]\nDescription=My App Service\nAfter=network.target\n\n[Service]\nUser=myappuser\nGroup=myappuser\nWorkingDirectory=/var/www/myapp\nExecStart=/usr/bin/node app.js\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target\n","ini","",[15,27,28,37,48,57,64,70,79,87,96,105,114,119,125],{"__ignoreMap":25},[29,30,33],"span",{"class":31,"line":32},"line",1,[29,34,36],{"class":35},"shcOC","[Unit]\n",[29,38,40,44],{"class":31,"line":39},2,[29,41,43],{"class":42},"so5gQ","Description",[29,45,47],{"class":46},"slsVL","=My App Service\n",[29,49,51,54],{"class":31,"line":50},3,[29,52,53],{"class":42},"After",[29,55,56],{"class":46},"=network.target\n",[29,58,60],{"class":31,"line":59},4,[29,61,63],{"emptyLinePlaceholder":62},true,"\n",[29,65,67],{"class":31,"line":66},5,[29,68,69],{"class":35},"[Service]\n",[29,71,73,76],{"class":31,"line":72},6,[29,74,75],{"class":42},"User",[29,77,78],{"class":46},"=myappuser\n",[29,80,82,85],{"class":31,"line":81},7,[29,83,84],{"class":42},"Group",[29,86,78],{"class":46},[29,88,90,93],{"class":31,"line":89},8,[29,91,92],{"class":42},"WorkingDirectory",[29,94,95],{"class":46},"=/var/www/myapp\n",[29,97,99,102],{"class":31,"line":98},9,[29,100,101],{"class":42},"ExecStart",[29,103,104],{"class":46},"=/usr/bin/node app.js\n",[29,106,108,111],{"class":31,"line":107},10,[29,109,110],{"class":42},"Restart",[29,112,113],{"class":46},"=on-failure\n",[29,115,117],{"class":31,"line":116},11,[29,118,63],{"emptyLinePlaceholder":62},[29,120,122],{"class":31,"line":121},12,[29,123,124],{"class":35},"[Install]\n",[29,126,128,131],{"class":31,"line":127},13,[29,129,130],{"class":42},"WantedBy",[29,132,133],{"class":46},"=multi-user.target\n",[135,136,137,144],"blockquote",{},[138,139,140],"p",{},[141,142,143],"strong",{},"Explanation of Unit Sections:",[145,146,147,154,160],"ul",{},[148,149,150,153],"li",{},[141,151,152],{},"[Unit]",": Metadata and dependencies.",[148,155,156,159],{},[141,157,158],{},"[Service]",": How the service runs.",[148,161,162,165,166,169],{},[141,163,164],{},"[Install]",": Installation details for ",[15,167,168],{},"enable",".",[171,172],"hr",{},[10,174,176],{"id":175},"_1-create-and-edit-the-service-file","1. Create and Edit the Service File",[20,178,182],{"className":179,"code":180,"language":181,"meta":25,"style":25},"language-bash shiki shiki-themes github-light github-dark github-dark","sudo nano /etc/systemd/system/myapp.service\n","bash",[15,183,184],{"__ignoreMap":25},[29,185,186,189,193],{"class":31,"line":32},[29,187,188],{"class":35},"sudo",[29,190,192],{"class":191},"sfrk1"," nano",[29,194,195],{"class":191}," /etc/systemd/system/myapp.service\n",[145,197,198],{},[148,199,200,201,204],{},"Opens the ",[15,202,203],{},"myapp.service"," file in the nano editor with root privileges.",[171,206],{},[10,208,210],{"id":209},"_2-reload-systemd-configuration","2. Reload systemd Configuration",[20,212,214],{"className":179,"code":213,"language":181,"meta":25,"style":25},"sudo systemctl daemon-reexec\nsudo systemctl daemon-reload\n",[15,215,216,226],{"__ignoreMap":25},[29,217,218,220,223],{"class":31,"line":32},[29,219,188],{"class":35},[29,221,222],{"class":191}," systemctl",[29,224,225],{"class":191}," daemon-reexec\n",[29,227,228,230,232],{"class":31,"line":39},[29,229,188],{"class":35},[29,231,222],{"class":191},[29,233,234],{"class":191}," daemon-reload\n",[145,236,237,243],{},[148,238,239,242],{},[141,240,241],{},"daemon-reexec",": Reexecute the systemd manager to pick up code changes.",[148,244,245,248],{},[141,246,247],{},"daemon-reload",": Reload unit files to register new or changed services.",[171,250],{},[10,252,254],{"id":253},"_3-enable-the-service-at-boot","3. Enable the Service at Boot",[20,256,258],{"className":179,"code":257,"language":181,"meta":25,"style":25},"sudo systemctl enable myapp.service\n",[15,259,260],{"__ignoreMap":25},[29,261,262,264,266,269],{"class":31,"line":32},[29,263,188],{"class":35},[29,265,222],{"class":191},[29,267,268],{"class":191}," enable",[29,270,271],{"class":191}," myapp.service\n",[145,273,274],{},[148,275,276,277,279],{},"Creates symlinks so that ",[15,278,203],{}," starts automatically on system boot.",[171,281],{},[10,283,285],{"id":284},"_4-start-the-service","4. Start the Service",[20,287,289],{"className":179,"code":288,"language":181,"meta":25,"style":25},"sudo systemctl start myapp.service\n",[15,290,291],{"__ignoreMap":25},[29,292,293,295,297,300],{"class":31,"line":32},[29,294,188],{"class":35},[29,296,222],{"class":191},[29,298,299],{"class":191}," start",[29,301,271],{"class":191},[145,303,304],{},[148,305,306,307,309],{},"Launches the ",[15,308,203],{}," immediately.",[171,311],{},[10,313,315],{"id":314},"_5-check-status-and-logs","5. Check Status and Logs",[20,317,319],{"className":179,"code":318,"language":181,"meta":25,"style":25},"sudo systemctl status myapp.service\njournalctl -u myapp.service -f\n",[15,320,321,332],{"__ignoreMap":25},[29,322,323,325,327,330],{"class":31,"line":32},[29,324,188],{"class":35},[29,326,222],{"class":191},[29,328,329],{"class":191}," status",[29,331,271],{"class":191},[29,333,334,337,341,344],{"class":31,"line":39},[29,335,336],{"class":35},"journalctl",[29,338,340],{"class":339},"suiK_"," -u",[29,342,343],{"class":191}," myapp.service",[29,345,346],{"class":339}," -f\n",[145,348,349,355],{},[148,350,351,354],{},[141,352,353],{},"status",": Shows service state, PID, recent logs, and errors.",[148,356,357,360,361,364,365,367],{},[141,358,359],{},"journalctl -u",": Follows logs (",[15,362,363],{},"-f",") for ",[15,366,203],{}," in real time.",[171,369],{},[10,371,373],{"id":372},"_6-useful-service-directives","6. Useful [Service] Directives",[138,375,376,377,379,380,383],{},"Below are configuration snippets you can add under the ",[15,378,158],{}," section to customize behavior. They are ",[141,381,382],{},"not"," shell commands but unit file directives.",[385,386,388],"h3",{"id":387},"_61-environment-files","6.1 Environment & Files",[20,390,392],{"className":22,"code":391,"language":24,"meta":25,"style":25},"Environment=NODE_ENV=production PORT=8080         # Inline env vars\nEnvironmentFile=-/etc/myapp.env                   # Load env from file, ignore if missing\nWorkingDirectory=/var/www/myapp                   # Set working directory\nPIDFile=/run/myapp.pid                            # Path for PID tracking\n",[15,393,394,418,429,439],{"__ignoreMap":25},[29,395,396,399,402,405,408,411,414],{"class":31,"line":32},[29,397,398],{"class":42},"Environment",[29,400,401],{"class":46},"=",[29,403,404],{"class":42},"NODE_ENV",[29,406,407],{"class":46},"=production ",[29,409,410],{"class":42},"PORT",[29,412,413],{"class":46},"=8080         ",[29,415,417],{"class":416},"sCsY4","# Inline env vars\n",[29,419,420,423,426],{"class":31,"line":39},[29,421,422],{"class":42},"EnvironmentFile",[29,424,425],{"class":46},"=-/etc/myapp.env                   ",[29,427,428],{"class":416},"# Load env from file, ignore if missing\n",[29,430,431,433,436],{"class":31,"line":50},[29,432,92],{"class":42},[29,434,435],{"class":46},"=/var/www/myapp                   ",[29,437,438],{"class":416},"# Set working directory\n",[29,440,441,444,447],{"class":31,"line":59},[29,442,443],{"class":42},"PIDFile",[29,445,446],{"class":46},"=/run/myapp.pid                            ",[29,448,449],{"class":416},"# Path for PID tracking\n",[385,451,453],{"id":452},"_62-resource-limits-timeouts","6.2 Resource Limits & Timeouts",[20,455,457],{"className":22,"code":456,"language":24,"meta":25,"style":25},"TimeoutStartSec=30                 # Max seconds to start before timeout\nTimeoutStopSec=10                  # Max seconds to stop before SIGKILL\nRestartSec=5                       # Delay before restarting\nMemoryMax=200M                     # cgroup memory cap\nCPUQuota=20%                       # cgroup CPU cap\nStartLimitIntervalSec=60           # Window for restart rate limiting\nStartLimitBurst=3                  # Max restarts in interval\n",[15,458,459,470,481,492,503,514,525],{"__ignoreMap":25},[29,460,461,464,467],{"class":31,"line":32},[29,462,463],{"class":42},"TimeoutStartSec",[29,465,466],{"class":46},"=30                 ",[29,468,469],{"class":416},"# Max seconds to start before timeout\n",[29,471,472,475,478],{"class":31,"line":39},[29,473,474],{"class":42},"TimeoutStopSec",[29,476,477],{"class":46},"=10                  ",[29,479,480],{"class":416},"# Max seconds to stop before SIGKILL\n",[29,482,483,486,489],{"class":31,"line":50},[29,484,485],{"class":42},"RestartSec",[29,487,488],{"class":46},"=5                       ",[29,490,491],{"class":416},"# Delay before restarting\n",[29,493,494,497,500],{"class":31,"line":59},[29,495,496],{"class":42},"MemoryMax",[29,498,499],{"class":46},"=200M                     ",[29,501,502],{"class":416},"# cgroup memory cap\n",[29,504,505,508,511],{"class":31,"line":66},[29,506,507],{"class":42},"CPUQuota",[29,509,510],{"class":46},"=20%                       ",[29,512,513],{"class":416},"# cgroup CPU cap\n",[29,515,516,519,522],{"class":31,"line":72},[29,517,518],{"class":42},"StartLimitIntervalSec",[29,520,521],{"class":46},"=60           ",[29,523,524],{"class":416},"# Window for restart rate limiting\n",[29,526,527,530,533],{"class":31,"line":81},[29,528,529],{"class":42},"StartLimitBurst",[29,531,532],{"class":46},"=3                  ",[29,534,535],{"class":416},"# Max restarts in interval\n",[385,537,539],{"id":538},"_63-logging-output","6.3 Logging & Output",[20,541,543],{"className":22,"code":542,"language":24,"meta":25,"style":25},"StandardOutput=journal            # Send stdout to journal\nStandardError=journal             # Send stderr to journal\nSyslogIdentifier=myapp            # Tag logs in journal\n# Or redirect to files:\nStandardOutput=append:/var/log/myapp.log\nStandardError=append:/var/log/myapp-error.log\n",[15,544,545,556,567,578,583,590],{"__ignoreMap":25},[29,546,547,550,553],{"class":31,"line":32},[29,548,549],{"class":42},"StandardOutput",[29,551,552],{"class":46},"=journal            ",[29,554,555],{"class":416},"# Send stdout to journal\n",[29,557,558,561,564],{"class":31,"line":39},[29,559,560],{"class":42},"StandardError",[29,562,563],{"class":46},"=journal             ",[29,565,566],{"class":416},"# Send stderr to journal\n",[29,568,569,572,575],{"class":31,"line":50},[29,570,571],{"class":42},"SyslogIdentifier",[29,573,574],{"class":46},"=myapp            ",[29,576,577],{"class":416},"# Tag logs in journal\n",[29,579,580],{"class":31,"line":59},[29,581,582],{"class":416},"# Or redirect to files:\n",[29,584,585,587],{"class":31,"line":66},[29,586,549],{"class":42},[29,588,589],{"class":46},"=append:/var/log/myapp.log\n",[29,591,592,594],{"class":31,"line":72},[29,593,560],{"class":42},[29,595,596],{"class":46},"=append:/var/log/myapp-error.log\n",[385,598,600],{"id":599},"_64-process-control-hooks","6.4 Process Control & Hooks",[20,602,604],{"className":22,"code":603,"language":24,"meta":25,"style":25},"ExecStartPre=/usr/bin/npm install         # Run before main start\nExecStartPre=/bin/sleep 10                # Delay service start by 10s\nExecStartPost=/bin/echo \"App started\"    # Run after service has started\nExecStop=/usr/bin/node cleanup.js         # Run on service stop\nType=simple         # Run in foreground (default)\n# Alternative types:\n# Type=exec         # Run then exit\n# Type=forking      # Daemon forks to background\nKillMode=control-group                   # Kill whole process group\nKillMode=process                         # Or kill only main PID\nKillSignal=SIGINT                        # Signal to use on stop\n",[15,605,606,617,627,641,652,663,668,673,678,689,699],{"__ignoreMap":25},[29,607,608,611,614],{"class":31,"line":32},[29,609,610],{"class":42},"ExecStartPre",[29,612,613],{"class":46},"=/usr/bin/npm install         ",[29,615,616],{"class":416},"# Run before main start\n",[29,618,619,621,624],{"class":31,"line":39},[29,620,610],{"class":42},[29,622,623],{"class":46},"=/bin/sleep 10                ",[29,625,626],{"class":416},"# Delay service start by 10s\n",[29,628,629,632,635,638],{"class":31,"line":50},[29,630,631],{"class":42},"ExecStartPost",[29,633,634],{"class":46},"=/bin/echo ",[29,636,637],{"class":191},"\"App started\"",[29,639,640],{"class":416},"    # Run after service has started\n",[29,642,643,646,649],{"class":31,"line":59},[29,644,645],{"class":42},"ExecStop",[29,647,648],{"class":46},"=/usr/bin/node cleanup.js         ",[29,650,651],{"class":416},"# Run on service stop\n",[29,653,654,657,660],{"class":31,"line":66},[29,655,656],{"class":42},"Type",[29,658,659],{"class":46},"=simple         ",[29,661,662],{"class":416},"# Run in foreground (default)\n",[29,664,665],{"class":31,"line":72},[29,666,667],{"class":416},"# Alternative types:\n",[29,669,670],{"class":31,"line":81},[29,671,672],{"class":416},"# Type=exec         # Run then exit\n",[29,674,675],{"class":31,"line":89},[29,676,677],{"class":416},"# Type=forking      # Daemon forks to background\n",[29,679,680,683,686],{"class":31,"line":98},[29,681,682],{"class":42},"KillMode",[29,684,685],{"class":46},"=control-group                   ",[29,687,688],{"class":416},"# Kill whole process group\n",[29,690,691,693,696],{"class":31,"line":107},[29,692,682],{"class":42},[29,694,695],{"class":46},"=process                         ",[29,697,698],{"class":416},"# Or kill only main PID\n",[29,700,701,704,707],{"class":31,"line":116},[29,702,703],{"class":42},"KillSignal",[29,705,706],{"class":46},"=SIGINT                        ",[29,708,709],{"class":416},"# Signal to use on stop\n",[385,711,713],{"id":712},"_65-restart-behavior","6.5 Restart Behavior",[20,715,717],{"className":22,"code":716,"language":24,"meta":25,"style":25},"Restart=on-failure                       # Restart on non-zero exit\nRestartSec=5                             # Wait before restart\nStartLimitIntervalSec=60                 # Window for crash limit\nStartLimitBurst=3                        # Max crashes in window\n",[15,718,719,729,739,749],{"__ignoreMap":25},[29,720,721,723,726],{"class":31,"line":32},[29,722,110],{"class":42},[29,724,725],{"class":46},"=on-failure                       ",[29,727,728],{"class":416},"# Restart on non-zero exit\n",[29,730,731,733,736],{"class":31,"line":39},[29,732,485],{"class":42},[29,734,735],{"class":46},"=5                             ",[29,737,738],{"class":416},"# Wait before restart\n",[29,740,741,743,746],{"class":31,"line":50},[29,742,518],{"class":42},[29,744,745],{"class":46},"=60                 ",[29,747,748],{"class":416},"# Window for crash limit\n",[29,750,751,753,756],{"class":31,"line":59},[29,752,529],{"class":42},[29,754,755],{"class":46},"=3                        ",[29,757,758],{"class":416},"# Max crashes in window\n",[385,760,762],{"id":761},"_66-security-sandboxing","6.6 Security & Sandboxing",[20,764,766],{"className":22,"code":765,"language":24,"meta":25,"style":25},"NoNewPrivileges=true                    # Disable privilege escalation\nPrivateTmp=true                          # Isolate /tmp and /var/tmp\nPrivateDevices=true                      # Block access to device nodes\nProtectSystem=full                       # Mount /usr, /boot, etc as read-only\nProtectHome=true                         # Block access to home directories\nProtectKernelModules=true                # Restrict kernel module loading\nProtectControlGroups=true                # Restrict cgroup access\nProtectClock=true                        # Prevent time changes\nReadOnlyPaths=/var/www/myapp             # Mount path read-only\nReadWritePaths=/var/www/myapp/uploads    # Allow writes only here\nInaccessiblePaths=/etc/ssh               # Block access to sensitive paths\nCapabilityBoundingSet=CAP_NET_BIND_SERVICE   # Limit capabilities\nAmbientCapabilities=CAP_NET_BIND_SERVICE    # Grant capability to exec\n",[15,767,768,779,790,801,812,823,834,844,855,866,877,888,899],{"__ignoreMap":25},[29,769,770,773,776],{"class":31,"line":32},[29,771,772],{"class":42},"NoNewPrivileges",[29,774,775],{"class":46},"=true                    ",[29,777,778],{"class":416},"# Disable privilege escalation\n",[29,780,781,784,787],{"class":31,"line":39},[29,782,783],{"class":42},"PrivateTmp",[29,785,786],{"class":46},"=true                          ",[29,788,789],{"class":416},"# Isolate /tmp and /var/tmp\n",[29,791,792,795,798],{"class":31,"line":50},[29,793,794],{"class":42},"PrivateDevices",[29,796,797],{"class":46},"=true                      ",[29,799,800],{"class":416},"# Block access to device nodes\n",[29,802,803,806,809],{"class":31,"line":59},[29,804,805],{"class":42},"ProtectSystem",[29,807,808],{"class":46},"=full                       ",[29,810,811],{"class":416},"# Mount /usr, /boot, etc as read-only\n",[29,813,814,817,820],{"class":31,"line":66},[29,815,816],{"class":42},"ProtectHome",[29,818,819],{"class":46},"=true                         ",[29,821,822],{"class":416},"# Block access to home directories\n",[29,824,825,828,831],{"class":31,"line":72},[29,826,827],{"class":42},"ProtectKernelModules",[29,829,830],{"class":46},"=true                ",[29,832,833],{"class":416},"# Restrict kernel module loading\n",[29,835,836,839,841],{"class":31,"line":81},[29,837,838],{"class":42},"ProtectControlGroups",[29,840,830],{"class":46},[29,842,843],{"class":416},"# Restrict cgroup access\n",[29,845,846,849,852],{"class":31,"line":89},[29,847,848],{"class":42},"ProtectClock",[29,850,851],{"class":46},"=true                        ",[29,853,854],{"class":416},"# Prevent time changes\n",[29,856,857,860,863],{"class":31,"line":98},[29,858,859],{"class":42},"ReadOnlyPaths",[29,861,862],{"class":46},"=/var/www/myapp             ",[29,864,865],{"class":416},"# Mount path read-only\n",[29,867,868,871,874],{"class":31,"line":107},[29,869,870],{"class":42},"ReadWritePaths",[29,872,873],{"class":46},"=/var/www/myapp/uploads    ",[29,875,876],{"class":416},"# Allow writes only here\n",[29,878,879,882,885],{"class":31,"line":116},[29,880,881],{"class":42},"InaccessiblePaths",[29,883,884],{"class":46},"=/etc/ssh               ",[29,886,887],{"class":416},"# Block access to sensitive paths\n",[29,889,890,893,896],{"class":31,"line":121},[29,891,892],{"class":42},"CapabilityBoundingSet",[29,894,895],{"class":46},"=CAP_NET_BIND_SERVICE   ",[29,897,898],{"class":416},"# Limit capabilities\n",[29,900,901,904,907],{"class":31,"line":127},[29,902,903],{"class":42},"AmbientCapabilities",[29,905,906],{"class":46},"=CAP_NET_BIND_SERVICE    ",[29,908,909],{"class":416},"# Grant capability to exec\n",[385,911,913],{"id":912},"_67-startupshutdown-behavior","6.7 Startup/Shutdown Behavior",[20,915,917],{"className":22,"code":916,"language":24,"meta":25,"style":25},"After=network-online.target               # Start after network is up\nRequires=network-online.target            # Require this target\nConditionPathExists=/var/www/myapp/app.js # Only start if file exists\n",[15,918,919,929,940],{"__ignoreMap":25},[29,920,921,923,926],{"class":31,"line":32},[29,922,53],{"class":42},[29,924,925],{"class":46},"=network-online.target               ",[29,927,928],{"class":416},"# Start after network is up\n",[29,930,931,934,937],{"class":31,"line":39},[29,932,933],{"class":42},"Requires",[29,935,936],{"class":46},"=network-online.target            ",[29,938,939],{"class":416},"# Require this target\n",[29,941,942,945,948],{"class":31,"line":50},[29,943,944],{"class":42},"ConditionPathExists",[29,946,947],{"class":46},"=/var/www/myapp/app.js ",[29,949,950],{"class":416},"# Only start if file exists\n",[385,952,954],{"id":953},"_68-diagnostics-debugging","6.8 Diagnostics & Debugging",[20,956,958],{"className":22,"code":957,"language":24,"meta":25,"style":25},"# Run in debug mode\nExecStart=/usr/bin/node --inspect app.js\n# Enable verbose debug logs\nEnvironment=DEBUG=myapp:*\n",[15,959,960,965,972,977],{"__ignoreMap":25},[29,961,962],{"class":31,"line":32},[29,963,964],{"class":416},"# Run in debug mode\n",[29,966,967,969],{"class":31,"line":39},[29,968,101],{"class":42},[29,970,971],{"class":46},"=/usr/bin/node --inspect app.js\n",[29,973,974],{"class":31,"line":50},[29,975,976],{"class":416},"# Enable verbose debug logs\n",[29,978,979,981,983,986],{"class":31,"line":59},[29,980,398],{"class":42},[29,982,401],{"class":46},[29,984,985],{"class":42},"DEBUG",[29,987,988],{"class":46},"=myapp:*\n",[10,990,992],{"id":991},"_7-deploying-updates-and-recommendations","7. Deploying Updates and Recommendations",[994,995,996,1012,1031],"ol",{},[148,997,998,999],{},"After any change to unit or env files:",[20,1000,1002],{"className":179,"code":1001,"language":181,"meta":25,"style":25},"sudo systemctl daemon-reload\n",[15,1003,1004],{"__ignoreMap":25},[29,1005,1006,1008,1010],{"class":31,"line":32},[29,1007,188],{"class":35},[29,1009,222],{"class":191},[29,1011,234],{"class":191},[148,1013,1014,1015],{},"Restart the service:",[20,1016,1018],{"className":179,"code":1017,"language":181,"meta":25,"style":25},"sudo systemctl restart myapp.service\n",[15,1019,1020],{"__ignoreMap":25},[29,1021,1022,1024,1026,1029],{"class":31,"line":32},[29,1023,188],{"class":35},[29,1025,222],{"class":191},[29,1027,1028],{"class":191}," restart",[29,1030,271],{"class":191},[148,1032,1033,1034],{},"Check status and logs:",[20,1035,1036],{"className":179,"code":318,"language":181,"meta":25,"style":25},[15,1037,1038,1048],{"__ignoreMap":25},[29,1039,1040,1042,1044,1046],{"class":31,"line":32},[29,1041,188],{"class":35},[29,1043,222],{"class":191},[29,1045,329],{"class":191},[29,1047,271],{"class":191},[29,1049,1050,1052,1054,1056],{"class":31,"line":39},[29,1051,336],{"class":35},[29,1053,340],{"class":339},[29,1055,343],{"class":191},[29,1057,346],{"class":339},[10,1059,1061],{"id":1060},"_8-boot-time-analysis","8. Boot-Time Analysis",[20,1063,1065],{"className":179,"code":1064,"language":181,"meta":25,"style":25},"systemd-analyze blame               # Time taken by each service\nsystemd-analyze critical-chain      # Startup order and delays\nsystemd-analyze plot > boot.svg     # Visualize boot sequence\n",[15,1066,1067,1078,1088],{"__ignoreMap":25},[29,1068,1069,1072,1075],{"class":31,"line":32},[29,1070,1071],{"class":35},"systemd-analyze",[29,1073,1074],{"class":191}," blame",[29,1076,1077],{"class":416},"               # Time taken by each service\n",[29,1079,1080,1082,1085],{"class":31,"line":39},[29,1081,1071],{"class":35},[29,1083,1084],{"class":191}," critical-chain",[29,1086,1087],{"class":416},"      # Startup order and delays\n",[29,1089,1090,1092,1095,1098,1101],{"class":31,"line":50},[29,1091,1071],{"class":35},[29,1093,1094],{"class":191}," plot",[29,1096,1097],{"class":42}," >",[29,1099,1100],{"class":191}," boot.svg",[29,1102,1103],{"class":416},"     # Visualize boot sequence\n",[171,1105],{},[138,1107,1108],{},[1109,1110,1111],"em",{},"Use this complete reference to cover every directive and command discussed, ensuring a robust, secure systemd service for your Node.js application.",[10,1113,1115],{"id":1114},"_9-deploying-at-boot","9. Deploying at Boot",[20,1117,1119],{"className":179,"code":1118,"language":181,"meta":25,"style":25},"sudo systemctl enable myapp.service  # Start on boot\nsudo systemctl disable myapp.service # Disable autostart\n",[15,1120,1121,1134],{"__ignoreMap":25},[29,1122,1123,1125,1127,1129,1131],{"class":31,"line":32},[29,1124,188],{"class":35},[29,1126,222],{"class":191},[29,1128,268],{"class":191},[29,1130,343],{"class":191},[29,1132,1133],{"class":416},"  # Start on boot\n",[29,1135,1136,1138,1140,1143,1145],{"class":31,"line":39},[29,1137,188],{"class":35},[29,1139,222],{"class":191},[29,1141,1142],{"class":191}," disable",[29,1144,343],{"class":191},[29,1146,1147],{"class":416}," # Disable autostart\n",[385,1149,1151],{"id":1150},"deploying-updates-and-recommendations","Deploying Updates and Recommendations",[994,1153,1154],{},[148,1155,1156],{},"After any change to the unit file or environment files, run:",[20,1158,1159],{"className":179,"code":1001,"language":181,"meta":25,"style":25},[15,1160,1161],{"__ignoreMap":25},[29,1162,1163,1165,1167],{"class":31,"line":32},[29,1164,188],{"class":35},[29,1166,222],{"class":191},[29,1168,234],{"class":191},[994,1170,1171,1187],{"start":39},[148,1172,1014,1173],{},[20,1174,1175],{"className":179,"code":1017,"language":181,"meta":25,"style":25},[15,1176,1177],{"__ignoreMap":25},[29,1178,1179,1181,1183,1185],{"class":31,"line":32},[29,1180,188],{"class":35},[29,1182,222],{"class":191},[29,1184,1028],{"class":191},[29,1186,271],{"class":191},[148,1188,1189],{},"Verify status and logs as shown above.",[1191,1192,1194],"h1",{"id":1193},"targets-timers-and-exec-details","Targets, Timers, and Exec Details",[10,1196,1198],{"id":1197},"_1-targets-what-they-are-and-how-to-use-them","1) Targets — What They Are and How To Use Them",[385,1200,1202],{"id":1201},"_11-what-is-a-target","1.1 What is a target?",[145,1204,1205,1223,1244],{},[148,1206,1207,1208,1211,1212,1215,1216,1219,1220,169],{},"A ",[141,1209,1210],{},"target"," (",[15,1213,1214],{},"*.target",") is a ",[141,1217,1218],{},"labeled checkpoint/group"," used for ordering and grouping. It ",[141,1221,1222],{},"does not run code",[148,1224,1225,1226,1229,1230,1232,1233,1235,1236,1239,1240,1243],{},"Targets only support the ",[141,1227,1228],{},"generic"," sections: ",[15,1231,152],{}," and ",[15,1234,164],{},". There is ",[141,1237,1238],{},"no"," ",[15,1241,1242],{},"[Target]"," section.",[148,1245,1246,1247],{},"You use targets to:",[145,1248,1249,1252],{},[148,1250,1251],{},"Group services so they can start/stop together.",[148,1253,1254,1255,1211,1258,1261,1262,1265],{},"Set ",[141,1256,1257],{},"ordering",[15,1259,1260],{},"After=","/",[15,1263,1264],{},"Before=",") relative to a checkpoint.",[385,1267,1269,1270],{"id":1268},"_12-options-you-actually-use-in-a-target","1.2 Options you actually use in a ",[15,1271,1272],{},".target",[138,1274,1275,1276,1278],{},"(All are generic ",[15,1277,152],{}," options.)",[145,1280,1281,1329,1341],{},[148,1282,1283,1286],{},[141,1284,1285],{},"Dependencies (pull‑in):",[145,1287,1288,1294,1300,1314,1323],{},[148,1289,1290,1293],{},[15,1291,1292],{},"Wants=unit1 unit2"," — start these too (weak dep).",[148,1295,1296,1299],{},[15,1297,1298],{},"Requires=unit1"," — hard dep; if it fails/stops, this target fails/stops.",[148,1301,1302,1305,1306,1309,1310,1313],{},[15,1303,1304],{},"BindsTo=unit1"," — like ",[15,1307,1308],{},"Requires=",", but also stops if ",[15,1311,1312],{},"unit1"," disappears (e.g., a device).",[148,1315,1316,1319,1320,1322],{},[15,1317,1318],{},"PartOf=unit1"," — link lifecycles; stopping ",[15,1321,1312],{}," also stops this.",[148,1324,1325,1328],{},[15,1326,1327],{},"Conflicts=unit1"," — cannot be active together.",[148,1330,1331,1239,1334,1337,1338,169],{},[141,1332,1333],{},"Ordering (no pull‑in):",[15,1335,1336],{},"After=unit1"," / ",[15,1339,1340],{},"Before=unit1",[148,1342,1343,1239,1346,1349,1350,1353],{},[141,1344,1345],{},"Switching:",[15,1347,1348],{},"AllowIsolate=yes"," — allows ",[15,1351,1352],{},"systemctl isolate my.target"," (switch the system to only that group).",[138,1355,1356],{},[141,1357,1358],{},"[Install] section (wiring at enable time):",[145,1360,1361,1367],{},[148,1362,1363,1366],{},[15,1364,1365],{},"WantedBy=multi-user.target"," — enabling your target creates a symlink so it’s part of normal boots.",[148,1368,1369,1372,1373,1376],{},[15,1370,1371],{},"RequiredBy=…",", ",[15,1374,1375],{},"Alias=…"," — less common; same idea.",[385,1378,1380],{"id":1379},"_13-common-targets-youll-meet","1.3 Common targets you’ll meet",[145,1382,1383,1389,1395,1405,1419,1431],{},[148,1384,1385,1388],{},[15,1386,1387],{},"multi-user.target"," — standard server boot (no GUI). Most daemons attach here.",[148,1390,1391,1394],{},[15,1392,1393],{},"graphical.target"," — multi-user + display manager.",[148,1396,1397,1400,1401,1404],{},[15,1398,1399],{},"network.target"," — networking stack is initialized (",[141,1402,1403],{},"may not"," have an IP yet).",[148,1406,1407,1410,1411,1414,1415,1418],{},[15,1408,1409],{},"network-online.target"," — a checkpoint that ",[141,1412,1413],{},"waits until the network is up"," (only effective if a system-specific ",[1109,1416,1417],{},"wait-online"," unit is present; see 1.5).",[148,1420,1421,1372,1424,1372,1427,1430],{},[15,1422,1423],{},"sockets.target",[15,1425,1426],{},"timers.target",[15,1428,1429],{},"paths.target"," — milestones socket/timer/path units hook into.",[148,1432,1433,1372,1436,1372,1439,1442],{},[15,1434,1435],{},"shutdown.target",[15,1437,1438],{},"basic.target",[15,1440,1441],{},"rescue.target"," — other system milestones.",[385,1444,1446],{"id":1445},"_14-example-group-services-behind-a-custom-target","1.4 Example: group services behind a custom target",[20,1448,1450],{"className":22,"code":1449,"language":24,"meta":25,"style":25},"# /etc/systemd/system/my-stack.target\n[Unit]\nDescription=My app stack (API + worker)\nWants=myapi.service myworker.service\nAfter=network-online.target\nAllowIsolate=yes\n\n[Install]\nWantedBy=multi-user.target\n",[15,1451,1452,1457,1461,1468,1476,1483,1491,1495,1499],{"__ignoreMap":25},[29,1453,1454],{"class":31,"line":32},[29,1455,1456],{"class":416},"# /etc/systemd/system/my-stack.target\n",[29,1458,1459],{"class":31,"line":39},[29,1460,36],{"class":35},[29,1462,1463,1465],{"class":31,"line":50},[29,1464,43],{"class":42},[29,1466,1467],{"class":46},"=My app stack (API + worker)\n",[29,1469,1470,1473],{"class":31,"line":59},[29,1471,1472],{"class":42},"Wants",[29,1474,1475],{"class":46},"=myapi.service myworker.service\n",[29,1477,1478,1480],{"class":31,"line":66},[29,1479,53],{"class":42},[29,1481,1482],{"class":46},"=network-online.target\n",[29,1484,1485,1488],{"class":31,"line":72},[29,1486,1487],{"class":42},"AllowIsolate",[29,1489,1490],{"class":46},"=yes\n",[29,1492,1493],{"class":31,"line":81},[29,1494,63],{"emptyLinePlaceholder":62},[29,1496,1497],{"class":31,"line":89},[29,1498,124],{"class":35},[29,1500,1501,1503],{"class":31,"line":98},[29,1502,130],{"class":42},[29,1504,133],{"class":46},[138,1506,1507],{},"Usage:",[20,1509,1511],{"className":179,"code":1510,"language":181,"meta":25,"style":25},"systemctl daemon-reload\nsystemctl enable --now my-stack.target\nsystemctl start my-stack.target         # starts the group\nsystemctl list-dependencies my-stack.target\n",[15,1512,1513,1520,1532,1544],{"__ignoreMap":25},[29,1514,1515,1518],{"class":31,"line":32},[29,1516,1517],{"class":35},"systemctl",[29,1519,234],{"class":191},[29,1521,1522,1524,1526,1529],{"class":31,"line":39},[29,1523,1517],{"class":35},[29,1525,268],{"class":191},[29,1527,1528],{"class":339}," --now",[29,1530,1531],{"class":191}," my-stack.target\n",[29,1533,1534,1536,1538,1541],{"class":31,"line":50},[29,1535,1517],{"class":35},[29,1537,299],{"class":191},[29,1539,1540],{"class":191}," my-stack.target",[29,1542,1543],{"class":416},"         # starts the group\n",[29,1545,1546,1548,1551],{"class":31,"line":59},[29,1547,1517],{"class":35},[29,1549,1550],{"class":191}," list-dependencies",[29,1552,1531],{"class":191},[385,1554,1556],{"id":1555},"_15-afternetwork-onlinetarget-ordering-vs-pulling-it-in","1.5 \"After=network-online.target\" (ordering) vs pulling it in",[145,1558,1559,1569,1593,1633],{},[148,1560,1561,1564,1565,1568],{},[15,1562,1563],{},"After=network-online.target"," ⇒ start ",[141,1566,1567],{},"after"," that checkpoint (ordering only).",[148,1570,1571,1572,1575,1576],{},"If you also want it ",[141,1573,1574],{},"included"," in the boot transaction, add:",[20,1577,1579],{"className":22,"code":1578,"language":24,"meta":25,"style":25},"Wants=network-online.target\nAfter=network-online.target\n",[15,1580,1581,1587],{"__ignoreMap":25},[29,1582,1583,1585],{"class":31,"line":32},[29,1584,1472],{"class":42},[29,1586,1482],{"class":46},[29,1588,1589,1591],{"class":31,"line":39},[29,1590,53],{"class":42},[29,1592,1482],{"class":46},[148,1594,1595,1596],{},"Ensure your network stack provides the wait helper:",[20,1597,1599],{"className":179,"code":1598,"language":181,"meta":25,"style":25},"# for systemd-networkd setups\nsystemctl status systemd-networkd-wait-online.service\n\n# for NetworkManager setups\nsystemctl status NetworkManager-wait-online.service\n",[15,1600,1601,1606,1615,1619,1624],{"__ignoreMap":25},[29,1602,1603],{"class":31,"line":32},[29,1604,1605],{"class":416},"# for systemd-networkd setups\n",[29,1607,1608,1610,1612],{"class":31,"line":39},[29,1609,1517],{"class":35},[29,1611,329],{"class":191},[29,1613,1614],{"class":191}," systemd-networkd-wait-online.service\n",[29,1616,1617],{"class":31,"line":50},[29,1618,63],{"emptyLinePlaceholder":62},[29,1620,1621],{"class":31,"line":59},[29,1622,1623],{"class":416},"# for NetworkManager setups\n",[29,1625,1626,1628,1630],{"class":31,"line":66},[29,1627,1517],{"class":35},[29,1629,329],{"class":191},[29,1631,1632],{"class":191}," NetworkManager-wait-online.service\n",[148,1634,1635,1636,1639,1640,1643],{},"Remember: ",[1109,1637,1638],{},"online"," is a ",[141,1641,1642],{},"boot-time checkpoint",", not a live network monitor.",[171,1645],{},[10,1647,1649],{"id":1648},"_2-timers-cron-replacement-clear-mechanics","2) Timers — Cron Replacement (Clear Mechanics)",[385,1651,1653],{"id":1652},"_21-how-a-timer-triggers-a-service","2.1 How a timer triggers a service",[145,1655,1656,1670,1680],{},[148,1657,1658,1659,1662,1663,1239,1666,1669],{},"Naming rule: ",[15,1660,1661],{},"X.timer"," triggers ",[15,1664,1665],{},"X.service",[141,1667,1668],{},"by default"," (basename match).",[148,1671,1672,1673,1676,1677,1243],{},"To trigger a differently named unit, set ",[15,1674,1675],{},"Unit=that.service"," in the timer’s ",[15,1678,1679],{},"[Timer]",[148,1681,1682,1685],{},[141,1683,1684],{},"Enable the timer",", not the service, to put it on schedule.",[385,1687,1689],{"id":1688},"_22-timer-sections-and-key-options","2.2 Timer sections and key options",[138,1691,1692,1693,1695],{},"Timer units have a ",[15,1694,1679],{}," section with two families of triggers:",[138,1697,1698,1701],{},[141,1699,1700],{},"A) Monotonic (relative) triggers"," — based on elapsed time",[145,1703,1704,1713,1719,1729,1739],{},[148,1705,1706,1709,1710,169],{},[15,1707,1708],{},"OnBootSec=5min"," — 5 minutes ",[141,1711,1712],{},"after boot",[148,1714,1715,1718],{},[15,1716,1717],{},"OnStartupSec=30s"," — 30s after the service manager starts (subtle difference from boot).",[148,1720,1721,1724,1725,1728],{},[15,1722,1723],{},"OnActiveSec=1h"," — 1 hour after the ",[141,1726,1727],{},"timer"," became active.",[148,1730,1731,1734,1735,1738],{},[15,1732,1733],{},"OnUnitActiveSec=15min"," — 15 minutes after the ",[141,1736,1737],{},"triggered unit"," last ran.",[148,1740,1741,1744],{},[15,1742,1743],{},"OnUnitInactiveSec=10min"," — 10 minutes after the unit last went inactive.",[138,1746,1747,1750],{},[141,1748,1749],{},"B) Calendar (wall‑clock) triggers"," — real dates/times",[145,1752,1753,1759,1765,1771,1777],{},[148,1754,1755,1758],{},[15,1756,1757],{},"OnCalendar=daily"," — every day at 00:00.",[148,1760,1761,1764],{},[15,1762,1763],{},"OnCalendar=02:00"," — every day at 02:00.",[148,1766,1767,1770],{},[15,1768,1769],{},"OnCalendar=Mon..Fri 02:00"," — weekdays at 02:00.",[148,1772,1773,1776],{},[15,1774,1775],{},"OnCalendar=*-*-01 00:00"," — first day of every month at midnight.",[148,1778,1779,1782],{},[15,1780,1781],{},"OnCalendar=2025-08-12 14:30:00"," — specific date/time.",[138,1784,1785],{},[141,1786,1787],{},"Behavior modifiers",[145,1789,1790,1796,1802,1808,1814],{},[148,1791,1792,1795],{},[15,1793,1794],{},"Persistent=true"," — if a run was missed (machine was off), run once on the next boot.",[148,1797,1798,1801],{},[15,1799,1800],{},"RandomizedDelaySec=5m"," — add a random delay to spread load.",[148,1803,1804,1807],{},[15,1805,1806],{},"AccuracySec=1m"," — coalesce timers for efficiency; use smaller if you need precision.",[148,1809,1810,1813],{},[15,1811,1812],{},"WakeSystem=yes"," — attempt to wake from suspend for the job (hardware/permissions permitting).",[148,1815,1816,1819],{},[15,1817,1818],{},"Unit=foo.service"," — (optional) explicit unit name to trigger.",[138,1821,1822],{},[141,1823,1824],{},"[Install] for timers",[145,1826,1827],{},[148,1828,1829,1832],{},[15,1830,1831],{},"WantedBy=timers.target"," — enabling the timer hooks it into the system’s timer milestone.",[385,1834,1836],{"id":1835},"_23-minimal-working-pairs-copypaste","2.3 Minimal working pairs (copy/paste)",[138,1838,1839],{},[141,1840,1841],{},"Nightly backup at 02:00, catch up if missed",[20,1843,1845],{"className":22,"code":1844,"language":24,"meta":25,"style":25},"# /etc/systemd/system/backup.service\n[Unit]\nDescription=Nightly backup job\n\n[Service]\nType=oneshot\nExecStart=/usr/local/bin/backup.sh\n",[15,1846,1847,1852,1856,1863,1867,1871,1878],{"__ignoreMap":25},[29,1848,1849],{"class":31,"line":32},[29,1850,1851],{"class":416},"# /etc/systemd/system/backup.service\n",[29,1853,1854],{"class":31,"line":39},[29,1855,36],{"class":35},[29,1857,1858,1860],{"class":31,"line":50},[29,1859,43],{"class":42},[29,1861,1862],{"class":46},"=Nightly backup job\n",[29,1864,1865],{"class":31,"line":59},[29,1866,63],{"emptyLinePlaceholder":62},[29,1868,1869],{"class":31,"line":66},[29,1870,69],{"class":35},[29,1872,1873,1875],{"class":31,"line":72},[29,1874,656],{"class":42},[29,1876,1877],{"class":46},"=oneshot\n",[29,1879,1880,1882],{"class":31,"line":81},[29,1881,101],{"class":42},[29,1883,1884],{"class":46},"=/usr/local/bin/backup.sh\n",[20,1886,1888],{"className":22,"code":1887,"language":24,"meta":25,"style":25},"# /etc/systemd/system/backup.timer\n[Unit]\nDescription=Run backup every night at 02:00\n\n[Timer]\nOnCalendar=02:00\nPersistent=true\nRandomizedDelaySec=5m\nAccuracySec=1m\n\n[Install]\nWantedBy=timers.target\n",[15,1889,1890,1895,1899,1906,1910,1915,1923,1931,1939,1947,1951,1955],{"__ignoreMap":25},[29,1891,1892],{"class":31,"line":32},[29,1893,1894],{"class":416},"# /etc/systemd/system/backup.timer\n",[29,1896,1897],{"class":31,"line":39},[29,1898,36],{"class":35},[29,1900,1901,1903],{"class":31,"line":50},[29,1902,43],{"class":42},[29,1904,1905],{"class":46},"=Run backup every night at 02:00\n",[29,1907,1908],{"class":31,"line":59},[29,1909,63],{"emptyLinePlaceholder":62},[29,1911,1912],{"class":31,"line":66},[29,1913,1914],{"class":35},"[Timer]\n",[29,1916,1917,1920],{"class":31,"line":72},[29,1918,1919],{"class":42},"OnCalendar",[29,1921,1922],{"class":46},"=02:00\n",[29,1924,1925,1928],{"class":31,"line":81},[29,1926,1927],{"class":42},"Persistent",[29,1929,1930],{"class":46},"=true\n",[29,1932,1933,1936],{"class":31,"line":89},[29,1934,1935],{"class":42},"RandomizedDelaySec",[29,1937,1938],{"class":46},"=5m\n",[29,1940,1941,1944],{"class":31,"line":98},[29,1942,1943],{"class":42},"AccuracySec",[29,1945,1946],{"class":46},"=1m\n",[29,1948,1949],{"class":31,"line":107},[29,1950,63],{"emptyLinePlaceholder":62},[29,1952,1953],{"class":31,"line":116},[29,1954,124],{"class":35},[29,1956,1957,1959],{"class":31,"line":121},[29,1958,130],{"class":42},[29,1960,1961],{"class":46},"=timers.target\n",[138,1963,1964],{},"Commands:",[20,1966,1968],{"className":179,"code":1967,"language":181,"meta":25,"style":25},"systemctl daemon-reload\nsystemctl enable --now backup.timer\nsystemctl list-timers --all\njournalctl -u backup.service -e\n",[15,1969,1970,1976,1987,1997],{"__ignoreMap":25},[29,1971,1972,1974],{"class":31,"line":32},[29,1973,1517],{"class":35},[29,1975,234],{"class":191},[29,1977,1978,1980,1982,1984],{"class":31,"line":39},[29,1979,1517],{"class":35},[29,1981,268],{"class":191},[29,1983,1528],{"class":339},[29,1985,1986],{"class":191}," backup.timer\n",[29,1988,1989,1991,1994],{"class":31,"line":50},[29,1990,1517],{"class":35},[29,1992,1993],{"class":191}," list-timers",[29,1995,1996],{"class":339}," --all\n",[29,1998,1999,2001,2003,2006],{"class":31,"line":59},[29,2000,336],{"class":35},[29,2002,340],{"class":339},[29,2004,2005],{"class":191}," backup.service",[29,2007,2008],{"class":339}," -e\n",[138,2010,2011],{},[141,2012,2013],{},"Every 15 minutes since last run finished",[20,2015,2017],{"className":22,"code":2016,"language":24,"meta":25,"style":25},"# /etc/systemd/system/clean-cache.service\n[Unit]\nDescription=Clean app cache\n\n[Service]\nType=oneshot\nExecStart=/usr/local/bin/clean_cache.sh\n",[15,2018,2019,2024,2028,2035,2039,2043,2049],{"__ignoreMap":25},[29,2020,2021],{"class":31,"line":32},[29,2022,2023],{"class":416},"# /etc/systemd/system/clean-cache.service\n",[29,2025,2026],{"class":31,"line":39},[29,2027,36],{"class":35},[29,2029,2030,2032],{"class":31,"line":50},[29,2031,43],{"class":42},[29,2033,2034],{"class":46},"=Clean app cache\n",[29,2036,2037],{"class":31,"line":59},[29,2038,63],{"emptyLinePlaceholder":62},[29,2040,2041],{"class":31,"line":66},[29,2042,69],{"class":35},[29,2044,2045,2047],{"class":31,"line":72},[29,2046,656],{"class":42},[29,2048,1877],{"class":46},[29,2050,2051,2053],{"class":31,"line":81},[29,2052,101],{"class":42},[29,2054,2055],{"class":46},"=/usr/local/bin/clean_cache.sh\n",[20,2057,2059],{"className":22,"code":2058,"language":24,"meta":25,"style":25},"# /etc/systemd/system/clean-cache.timer\n[Unit]\nDescription=Clean cache every 15 minutes (interval since last run)\n\n[Timer]\nOnUnitActiveSec=15min\n\n[Install]\nWantedBy=timers.target\n",[15,2060,2061,2066,2070,2077,2081,2085,2093,2097,2101],{"__ignoreMap":25},[29,2062,2063],{"class":31,"line":32},[29,2064,2065],{"class":416},"# /etc/systemd/system/clean-cache.timer\n",[29,2067,2068],{"class":31,"line":39},[29,2069,36],{"class":35},[29,2071,2072,2074],{"class":31,"line":50},[29,2073,43],{"class":42},[29,2075,2076],{"class":46},"=Clean cache every 15 minutes (interval since last run)\n",[29,2078,2079],{"class":31,"line":59},[29,2080,63],{"emptyLinePlaceholder":62},[29,2082,2083],{"class":31,"line":66},[29,2084,1914],{"class":35},[29,2086,2087,2090],{"class":31,"line":72},[29,2088,2089],{"class":42},"OnUnitActiveSec",[29,2091,2092],{"class":46},"=15min\n",[29,2094,2095],{"class":31,"line":81},[29,2096,63],{"emptyLinePlaceholder":62},[29,2098,2099],{"class":31,"line":89},[29,2100,124],{"class":35},[29,2102,2103,2105],{"class":31,"line":98},[29,2104,130],{"class":42},[29,2106,1961],{"class":46},[138,2108,2109],{},[141,2110,2111],{},"Hourly with jitter (avoid thundering herd)",[20,2113,2115],{"className":22,"code":2114,"language":24,"meta":25,"style":25},"# /etc/systemd/system/report.timer\n[Unit]\nDescription=Generate report hourly with jitter\n\n[Timer]\nOnCalendar=hourly\nRandomizedDelaySec=10m\nAccuracySec=1m\n\n[Install]\nWantedBy=timers.target\n",[15,2116,2117,2122,2126,2133,2137,2141,2148,2155,2161,2165,2169],{"__ignoreMap":25},[29,2118,2119],{"class":31,"line":32},[29,2120,2121],{"class":416},"# /etc/systemd/system/report.timer\n",[29,2123,2124],{"class":31,"line":39},[29,2125,36],{"class":35},[29,2127,2128,2130],{"class":31,"line":50},[29,2129,43],{"class":42},[29,2131,2132],{"class":46},"=Generate report hourly with jitter\n",[29,2134,2135],{"class":31,"line":59},[29,2136,63],{"emptyLinePlaceholder":62},[29,2138,2139],{"class":31,"line":66},[29,2140,1914],{"class":35},[29,2142,2143,2145],{"class":31,"line":72},[29,2144,1919],{"class":42},[29,2146,2147],{"class":46},"=hourly\n",[29,2149,2150,2152],{"class":31,"line":81},[29,2151,1935],{"class":42},[29,2153,2154],{"class":46},"=10m\n",[29,2156,2157,2159],{"class":31,"line":89},[29,2158,1943],{"class":42},[29,2160,1946],{"class":46},[29,2162,2163],{"class":31,"line":98},[29,2164,63],{"emptyLinePlaceholder":62},[29,2166,2167],{"class":31,"line":107},[29,2168,124],{"class":35},[29,2170,2171,2173],{"class":31,"line":116},[29,2172,130],{"class":42},[29,2174,1961],{"class":46},[385,2176,2178],{"id":2177},"_24-useful-timer-diagnostics","2.4 Useful timer diagnostics",[20,2180,2182],{"className":179,"code":2181,"language":181,"meta":25,"style":25},"systemctl list-timers --all                 # see next/last runs\nsystemctl status myjob.timer                # status of the schedule\nsystemctl status myjob.service              # status of the job itself\njournalctl -u myjob.service -e              # logs from the job\nsystemd-analyze calendar 'Mon..Fri 02:00'   # parse/preview a calendar spec\nsystemd-run --on-active=5s /bin/echo test   # ad-hoc timer-run to test mechanics\n",[15,2183,2184,2196,2208,2220,2234,2247],{"__ignoreMap":25},[29,2185,2186,2188,2190,2193],{"class":31,"line":32},[29,2187,1517],{"class":35},[29,2189,1993],{"class":191},[29,2191,2192],{"class":339}," --all",[29,2194,2195],{"class":416},"                 # see next/last runs\n",[29,2197,2198,2200,2202,2205],{"class":31,"line":39},[29,2199,1517],{"class":35},[29,2201,329],{"class":191},[29,2203,2204],{"class":191}," myjob.timer",[29,2206,2207],{"class":416},"                # status of the schedule\n",[29,2209,2210,2212,2214,2217],{"class":31,"line":50},[29,2211,1517],{"class":35},[29,2213,329],{"class":191},[29,2215,2216],{"class":191}," myjob.service",[29,2218,2219],{"class":416},"              # status of the job itself\n",[29,2221,2222,2224,2226,2228,2231],{"class":31,"line":59},[29,2223,336],{"class":35},[29,2225,340],{"class":339},[29,2227,2216],{"class":191},[29,2229,2230],{"class":339}," -e",[29,2232,2233],{"class":416},"              # logs from the job\n",[29,2235,2236,2238,2241,2244],{"class":31,"line":66},[29,2237,1071],{"class":35},[29,2239,2240],{"class":191}," calendar",[29,2242,2243],{"class":191}," 'Mon..Fri 02:00'",[29,2245,2246],{"class":416},"   # parse/preview a calendar spec\n",[29,2248,2249,2252,2255,2258,2261],{"class":31,"line":72},[29,2250,2251],{"class":35},"systemd-run",[29,2253,2254],{"class":339}," --on-active=5s",[29,2256,2257],{"class":191}," /bin/echo",[29,2259,2260],{"class":191}," test",[29,2262,2263],{"class":416},"   # ad-hoc timer-run to test mechanics\n",[171,2265],{},[10,2267,2269],{"id":2268},"_3-services-exec-types-restart-and-sandboxing-quick-but-precise","3) Services — Exec, Types, Restart, and Sandboxing (Quick but Precise)",[385,2271,2273],{"id":2272},"_31-exec-lines-startstopreload-hooks","3.1 Exec lines (start/stop/reload hooks)",[145,2275,2276,2294,2304],{},[148,2277,2278,2281,2282,2285,2286,2289,2290,2293],{},[141,2279,2280],{},"Absolute path required"," for the first token in ",[15,2283,2284],{},"ExecStart="," (e.g., ",[15,2287,2288],{},"/usr/bin/node",", not ",[15,2291,2292],{},"node",").",[148,2295,2296,2297,2300,2301,169],{},"If you need shell features (pipes, ",[15,2298,2299],{},"&&","), wrap them: ",[15,2302,2303],{},"ExecStart=/bin/bash -lc 'cmd1 && cmd2'",[148,2305,2306,2307,1372,2310,1372,2313,1372,2316,1372,2319,1372,2322,169],{},"Hooks: ",[15,2308,2309],{},"ExecStartPre=…",[15,2311,2312],{},"ExecStart=…",[15,2314,2315],{},"ExecStartPost=…",[15,2317,2318],{},"ExecReload=…",[15,2320,2321],{},"ExecStop=…",[15,2323,2324],{},"ExecStopPost=…",[138,2326,2327,2330],{},[141,2328,2329],{},"Exec prefixes"," (put before the path on that line):",[145,2332,2333,2339,2352,2364],{},[148,2334,2335,2338],{},[15,2336,2337],{},"-","  → ignore non‑zero exit (best‑effort step).",[148,2340,2341,2344,2345,2348,2349,2293],{},[15,2342,2343],{},"+","  → run with full root privileges (bypass ",[15,2346,2347],{},"User=","/caps ",[141,2350,2351],{},"for this command only",[148,2353,2354,2357,2358,1261,2360,2363],{},[15,2355,2356],{},"!","  → elevate only user/group creds (ignore ",[15,2359,2347],{},[15,2361,2362],{},"Group=",") but keep other sandboxes.",[148,2365,2366,2369,2370,2373],{},[15,2367,2368],{},"@","  → set custom ",[15,2371,2372],{},"argv[0]"," (rare).",[385,2375,2377,2378,2381],{"id":2376},"_32-type-how-systemd-decides-the-service-is-ready","3.2 ",[15,2379,2380],{},"Type="," (how systemd decides the service is ready)",[145,2383,2384,2393,2402,2411,2421],{},[148,2385,2386,2389,2390,2392],{},[15,2387,2388],{},"Type=simple"," (default) — run ",[15,2391,101],{}," and consider it the main process.",[148,2394,2395,2398,2399,2401],{},[15,2396,2397],{},"Type=oneshot"," — short tasks; can have multiple ",[15,2400,2284],{}," lines.",[148,2403,2404,2407,2408,169],{},[15,2405,2406],{},"Type=forking"," — legacy daemons that daemonize themselves; usually add ",[15,2409,2410],{},"PIDFile=",[148,2412,2413,2416,2417,2420],{},[15,2414,2415],{},"Type=notify"," — service calls ",[15,2418,2419],{},"sd_notify(READY=1)"," when ready.",[148,2422,2423,2426],{},[15,2424,2425],{},"Type=dbus"," — becomes ready when it acquires a D‑Bus name.",[385,2428,2430],{"id":2429},"_33-identity-environment-and-restart","3.3 Identity, environment, and restart",[145,2432,2433,2440,2446,2455,2469,2486],{},[148,2434,2435,1337,2437,2439],{},[15,2436,2347],{},[15,2438,2362],{}," — drop privileges.",[148,2441,2442,2445],{},[15,2443,2444],{},"WorkingDirectory="," — set CWD.",[148,2447,2448,2451,2452,169],{},[15,2449,2450],{},"Environment=KEY=VAL …"," and/or ",[15,2453,2454],{},"EnvironmentFile=/etc/myapp.env",[148,2456,2457,2458,2461,2462,2465,2466,169],{},"Restart policy: ",[15,2459,2460],{},"Restart=on-failure"," (good default), ",[15,2463,2464],{},"RestartSec=1s",". Others: ",[15,2467,2468],{},"no|on-success|on-abnormal|on-abort|always",[148,2470,2471,2472,2475,2476,2479,2480,1372,2483,169],{},"I/O and timeouts: ",[15,2473,2474],{},"StandardOutput=journal"," (default), ",[15,2477,2478],{},"StandardError=inherit|journal|null|file:/path","; ",[15,2481,2482],{},"TimeoutStartSec=",[15,2484,2485],{},"TimeoutStopSec=",[148,2487,2488,2489,2492,2493,169],{},"Kill behavior: ",[15,2490,2491],{},"KillMode=control-group"," (default: kill cgroup), ",[15,2494,2495],{},"SendSIGKILL=",[385,2497,2499],{"id":2498},"_34-minimal-hardening-flags-dial-back-if-needed","3.4 Minimal hardening flags (dial back if needed)",[138,2501,2502],{},"Add cautiously; remove if your app needs broader access.",[145,2504,2505,2510,2515,2524,2529,2540,2546,2554,2564],{},[148,2506,2507],{},[15,2508,2509],{},"NoNewPrivileges=yes",[148,2511,2512],{},[15,2513,2514],{},"PrivateTmp=yes",[148,2516,2517,2520,2521,18],{},[15,2518,2519],{},"ProtectSystem=strict"," (or ",[15,2522,2523],{},"full",[148,2525,2526],{},[15,2527,2528],{},"ProtectHome=read-only|yes",[148,2530,2531,1372,2534,1372,2537],{},[15,2532,2533],{},"ProtectKernelTunables=yes",[15,2535,2536],{},"ProtectKernelLogs=yes",[15,2538,2539],{},"ProtectControlGroups=yes",[148,2541,2542,2545],{},[15,2543,2544],{},"RestrictAddressFamilies=AF_INET AF_INET6"," (plus any others you need)",[148,2547,2548,1372,2551],{},[15,2549,2550],{},"RestrictSUIDSGID=yes",[15,2552,2553],{},"LockPersonality=yes",[148,2555,2556,2559,2560,2563],{},[15,2557,2558],{},"CapabilityBoundingSet="," (drop all or whitelist), ",[15,2561,2562],{},"AmbientCapabilities="," (grant minimal caps)",[148,2565,2566,2569],{},[15,2567,2568],{},"SystemCallFilter=@system-service"," (start here, narrow if you can)",[171,2571],{},[10,2573,2575],{"id":2574},"_4-ordering-vs-dependencies-one-glance-cheat-sheet","4) Ordering vs Dependencies — One-Glance Cheat Sheet",[145,2577,2578,2593,2606,2619],{},[148,2579,2580,1239,2583,1337,2586,2589,2590,2592],{},[141,2581,2582],{},"Ordering only:",[15,2584,2585],{},"After=X",[15,2587,2588],{},"Before=X"," (does ",[141,2591,382],{}," pull X in).",[148,2594,2595,1239,2598,2601,2602,2605],{},[141,2596,2597],{},"Pull‑in:",[15,2599,2600],{},"Wants=X"," (weak) / ",[15,2603,2604],{},"Requires=X"," (strong; if X fails/stops, so do you).",[148,2607,2608,1239,2611,2614,2615,2618],{},[141,2609,2610],{},"Lifecycle linking:",[15,2612,2613],{},"PartOf=X"," (stop/restart together), ",[15,2616,2617],{},"BindsTo=X"," (like Requires + stop if X disappears).",[148,2620,2621,1239,2624,169],{},[141,2622,2623],{},"Mutual exclusion:",[15,2625,2626],{},"Conflicts=X",[138,2628,2629],{},[141,2630,2631],{},"Common pattern — service that needs network at start:",[20,2633,2635],{"className":22,"code":2634,"language":24,"meta":25,"style":25},"[Unit]\nWants=network-online.target\nAfter=network-online.target\n",[15,2636,2637,2641,2647],{"__ignoreMap":25},[29,2638,2639],{"class":31,"line":32},[29,2640,36],{"class":35},[29,2642,2643,2645],{"class":31,"line":39},[29,2644,1472],{"class":42},[29,2646,1482],{"class":46},[29,2648,2649,2651],{"class":31,"line":50},[29,2650,53],{"class":42},[29,2652,1482],{"class":46},[138,2654,2655,2656,2659],{},"…and ensure your system has a ",[15,2657,2658],{},"*-wait-online.service"," for your network stack.",[171,2661],{},[10,2663,2665],{"id":2664},"_5-useful-commands-diagnostics-copypaste","5) Useful Commands & Diagnostics (Copy/Paste)",[20,2667,2669],{"className":179,"code":2668,"language":181,"meta":25,"style":25},"# See active units by type\nsystemctl list-units --type=service --state=running\nsystemctl list-units --type=target\n\n# Inspect unit dependencies/ordering\nsystemctl list-dependencies my-stack.target\nsystemd-analyze critical-chain myapi.service\n\n# Show the effective unit file (including drop-ins)\nsystemctl cat myapi.service\n\n# Verify a unit file’s syntax\nsystemd-analyze verify /etc/systemd/system/myapi.service\n\n# Enable/disable/start/stop/show state\nsystemctl enable --now foo.service\nsystemctl disable --now foo.service\nsystemctl is-enabled foo.service\nsystemctl is-active foo.service\n\n# Logs\njournalctl -u foo.service -b -e -f\n\n# Timers overview and testing\nsystemctl list-timers --all\nsystemd-analyze calendar 'Mon..Fri 02:00'\nsystemd-run --on-active=10s /usr/bin/echo test\n\n# Wait-online helpers (pick whichever your system uses)\nsystemctl status systemd-networkd-wait-online.service\nsystemctl status NetworkManager-wait-online.service\n",[15,2670,2671,2676,2689,2698,2702,2707,2715,2724,2728,2733,2742,2746,2751,2761,2766,2772,2784,2795,2805,2815,2820,2826,2843,2848,2854,2863,2873,2887,2892,2898,2907],{"__ignoreMap":25},[29,2672,2673],{"class":31,"line":32},[29,2674,2675],{"class":416},"# See active units by type\n",[29,2677,2678,2680,2683,2686],{"class":31,"line":39},[29,2679,1517],{"class":35},[29,2681,2682],{"class":191}," list-units",[29,2684,2685],{"class":339}," --type=service",[29,2687,2688],{"class":339}," --state=running\n",[29,2690,2691,2693,2695],{"class":31,"line":50},[29,2692,1517],{"class":35},[29,2694,2682],{"class":191},[29,2696,2697],{"class":339}," --type=target\n",[29,2699,2700],{"class":31,"line":59},[29,2701,63],{"emptyLinePlaceholder":62},[29,2703,2704],{"class":31,"line":66},[29,2705,2706],{"class":416},"# Inspect unit dependencies/ordering\n",[29,2708,2709,2711,2713],{"class":31,"line":72},[29,2710,1517],{"class":35},[29,2712,1550],{"class":191},[29,2714,1531],{"class":191},[29,2716,2717,2719,2721],{"class":31,"line":81},[29,2718,1071],{"class":35},[29,2720,1084],{"class":191},[29,2722,2723],{"class":191}," myapi.service\n",[29,2725,2726],{"class":31,"line":89},[29,2727,63],{"emptyLinePlaceholder":62},[29,2729,2730],{"class":31,"line":98},[29,2731,2732],{"class":416},"# Show the effective unit file (including drop-ins)\n",[29,2734,2735,2737,2740],{"class":31,"line":107},[29,2736,1517],{"class":35},[29,2738,2739],{"class":191}," cat",[29,2741,2723],{"class":191},[29,2743,2744],{"class":31,"line":116},[29,2745,63],{"emptyLinePlaceholder":62},[29,2747,2748],{"class":31,"line":121},[29,2749,2750],{"class":416},"# Verify a unit file’s syntax\n",[29,2752,2753,2755,2758],{"class":31,"line":127},[29,2754,1071],{"class":35},[29,2756,2757],{"class":191}," verify",[29,2759,2760],{"class":191}," /etc/systemd/system/myapi.service\n",[29,2762,2764],{"class":31,"line":2763},14,[29,2765,63],{"emptyLinePlaceholder":62},[29,2767,2769],{"class":31,"line":2768},15,[29,2770,2771],{"class":416},"# Enable/disable/start/stop/show state\n",[29,2773,2775,2777,2779,2781],{"class":31,"line":2774},16,[29,2776,1517],{"class":35},[29,2778,268],{"class":191},[29,2780,1528],{"class":339},[29,2782,2783],{"class":191}," foo.service\n",[29,2785,2787,2789,2791,2793],{"class":31,"line":2786},17,[29,2788,1517],{"class":35},[29,2790,1142],{"class":191},[29,2792,1528],{"class":339},[29,2794,2783],{"class":191},[29,2796,2798,2800,2803],{"class":31,"line":2797},18,[29,2799,1517],{"class":35},[29,2801,2802],{"class":191}," is-enabled",[29,2804,2783],{"class":191},[29,2806,2808,2810,2813],{"class":31,"line":2807},19,[29,2809,1517],{"class":35},[29,2811,2812],{"class":191}," is-active",[29,2814,2783],{"class":191},[29,2816,2818],{"class":31,"line":2817},20,[29,2819,63],{"emptyLinePlaceholder":62},[29,2821,2823],{"class":31,"line":2822},21,[29,2824,2825],{"class":416},"# Logs\n",[29,2827,2829,2831,2833,2836,2839,2841],{"class":31,"line":2828},22,[29,2830,336],{"class":35},[29,2832,340],{"class":339},[29,2834,2835],{"class":191}," foo.service",[29,2837,2838],{"class":339}," -b",[29,2840,2230],{"class":339},[29,2842,346],{"class":339},[29,2844,2846],{"class":31,"line":2845},23,[29,2847,63],{"emptyLinePlaceholder":62},[29,2849,2851],{"class":31,"line":2850},24,[29,2852,2853],{"class":416},"# Timers overview and testing\n",[29,2855,2857,2859,2861],{"class":31,"line":2856},25,[29,2858,1517],{"class":35},[29,2860,1993],{"class":191},[29,2862,1996],{"class":339},[29,2864,2866,2868,2870],{"class":31,"line":2865},26,[29,2867,1071],{"class":35},[29,2869,2240],{"class":191},[29,2871,2872],{"class":191}," 'Mon..Fri 02:00'\n",[29,2874,2876,2878,2881,2884],{"class":31,"line":2875},27,[29,2877,2251],{"class":35},[29,2879,2880],{"class":339}," --on-active=10s",[29,2882,2883],{"class":191}," /usr/bin/echo",[29,2885,2886],{"class":191}," test\n",[29,2888,2890],{"class":31,"line":2889},28,[29,2891,63],{"emptyLinePlaceholder":62},[29,2893,2895],{"class":31,"line":2894},29,[29,2896,2897],{"class":416},"# Wait-online helpers (pick whichever your system uses)\n",[29,2899,2901,2903,2905],{"class":31,"line":2900},30,[29,2902,1517],{"class":35},[29,2904,329],{"class":191},[29,2906,1614],{"class":191},[29,2908,2910,2912,2914],{"class":31,"line":2909},31,[29,2911,1517],{"class":35},[29,2913,329],{"class":191},[29,2915,1632],{"class":191},[171,2917],{},[10,2919,2921],{"id":2920},"_6-handy-patterns-tiny-recipes","6) Handy Patterns (Tiny Recipes)",[138,2923,2924],{},[141,2925,2926],{},"Start service only when a path is mounted",[20,2928,2930],{"className":22,"code":2929,"language":24,"meta":25,"style":25},"[Unit]\nRequiresMountsFor=/mnt/data\nAfter=network-online.target\nWants=network-online.target\n",[15,2931,2932,2936,2944,2950],{"__ignoreMap":25},[29,2933,2934],{"class":31,"line":32},[29,2935,36],{"class":35},[29,2937,2938,2941],{"class":31,"line":39},[29,2939,2940],{"class":42},"RequiresMountsFor",[29,2942,2943],{"class":46},"=/mnt/data\n",[29,2945,2946,2948],{"class":31,"line":50},[29,2947,53],{"class":42},[29,2949,1482],{"class":46},[29,2951,2952,2954],{"class":31,"line":59},[29,2953,1472],{"class":42},[29,2955,1482],{"class":46},[138,2957,2958],{},[141,2959,2960],{},"One-shot job + timer scaffold (reuse for migrations, syncs, etc.)",[20,2962,2964],{"className":22,"code":2963,"language":24,"meta":25,"style":25},"# job.service\n[Service]\nType=oneshot\nExecStart=/usr/local/bin/job.sh\n\n# job.timer\n[Timer]\nOnCalendar=Sun 03:30\nPersistent=true\n\n[Install]\nWantedBy=timers.target\n",[15,2965,2966,2971,2975,2981,2988,2992,2997,3001,3008,3014,3018,3022],{"__ignoreMap":25},[29,2967,2968],{"class":31,"line":32},[29,2969,2970],{"class":416},"# job.service\n",[29,2972,2973],{"class":31,"line":39},[29,2974,69],{"class":35},[29,2976,2977,2979],{"class":31,"line":50},[29,2978,656],{"class":42},[29,2980,1877],{"class":46},[29,2982,2983,2985],{"class":31,"line":59},[29,2984,101],{"class":42},[29,2986,2987],{"class":46},"=/usr/local/bin/job.sh\n",[29,2989,2990],{"class":31,"line":66},[29,2991,63],{"emptyLinePlaceholder":62},[29,2993,2994],{"class":31,"line":72},[29,2995,2996],{"class":416},"# job.timer\n",[29,2998,2999],{"class":31,"line":81},[29,3000,1914],{"class":35},[29,3002,3003,3005],{"class":31,"line":89},[29,3004,1919],{"class":42},[29,3006,3007],{"class":46},"=Sun 03:30\n",[29,3009,3010,3012],{"class":31,"line":98},[29,3011,1927],{"class":42},[29,3013,1930],{"class":46},[29,3015,3016],{"class":31,"line":107},[29,3017,63],{"emptyLinePlaceholder":62},[29,3019,3020],{"class":31,"line":116},[29,3021,124],{"class":35},[29,3023,3024,3026],{"class":31,"line":121},[29,3025,130],{"class":42},[29,3027,1961],{"class":46},[138,3029,3030],{},[141,3031,3032],{},"Group app daemons under a stack target",[20,3034,3036],{"className":22,"code":3035,"language":24,"meta":25,"style":25},"# my-stack.target\n[Unit]\nDescription=My stack\nWants=api.service worker.service\nAfter=network-online.target\n\n[Install]\nWantedBy=multi-user.target\n",[15,3037,3038,3043,3047,3054,3061,3067,3071,3075],{"__ignoreMap":25},[29,3039,3040],{"class":31,"line":32},[29,3041,3042],{"class":416},"# my-stack.target\n",[29,3044,3045],{"class":31,"line":39},[29,3046,36],{"class":35},[29,3048,3049,3051],{"class":31,"line":50},[29,3050,43],{"class":42},[29,3052,3053],{"class":46},"=My stack\n",[29,3055,3056,3058],{"class":31,"line":59},[29,3057,1472],{"class":42},[29,3059,3060],{"class":46},"=api.service worker.service\n",[29,3062,3063,3065],{"class":31,"line":66},[29,3064,53],{"class":42},[29,3066,1482],{"class":46},[29,3068,3069],{"class":31,"line":72},[29,3070,63],{"emptyLinePlaceholder":62},[29,3072,3073],{"class":31,"line":81},[29,3074,124],{"class":35},[29,3076,3077,3079],{"class":31,"line":89},[29,3078,130],{"class":42},[29,3080,133],{"class":46},[3082,3083,3084],"style",{},"html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}",{"title":25,"searchDepth":39,"depth":39,"links":3086},[3087,3089,3090,3091,3092,3093,3094,3104,3105,3106,3109,3117,3123,3130,3131,3132],{"id":12,"depth":39,"text":3088},"Service Unit File (/etc/systemd/system/myapp.service)",{"id":175,"depth":39,"text":176},{"id":209,"depth":39,"text":210},{"id":253,"depth":39,"text":254},{"id":284,"depth":39,"text":285},{"id":314,"depth":39,"text":315},{"id":372,"depth":39,"text":373,"children":3095},[3096,3097,3098,3099,3100,3101,3102,3103],{"id":387,"depth":50,"text":388},{"id":452,"depth":50,"text":453},{"id":538,"depth":50,"text":539},{"id":599,"depth":50,"text":600},{"id":712,"depth":50,"text":713},{"id":761,"depth":50,"text":762},{"id":912,"depth":50,"text":913},{"id":953,"depth":50,"text":954},{"id":991,"depth":39,"text":992},{"id":1060,"depth":39,"text":1061},{"id":1114,"depth":39,"text":1115,"children":3107},[3108],{"id":1150,"depth":50,"text":1151},{"id":1197,"depth":39,"text":1198,"children":3110},[3111,3112,3114,3115,3116],{"id":1201,"depth":50,"text":1202},{"id":1268,"depth":50,"text":3113},"1.2 Options you actually use in a .target",{"id":1379,"depth":50,"text":1380},{"id":1445,"depth":50,"text":1446},{"id":1555,"depth":50,"text":1556},{"id":1648,"depth":39,"text":1649,"children":3118},[3119,3120,3121,3122],{"id":1652,"depth":50,"text":1653},{"id":1688,"depth":50,"text":1689},{"id":1835,"depth":50,"text":1836},{"id":2177,"depth":50,"text":2178},{"id":2268,"depth":39,"text":2269,"children":3124},[3125,3126,3128,3129],{"id":2272,"depth":50,"text":2273},{"id":2376,"depth":50,"text":3127},"3.2 Type= (how systemd decides the service is ready)",{"id":2429,"depth":50,"text":2430},{"id":2498,"depth":50,"text":2499},{"id":2574,"depth":39,"text":2575},{"id":2664,"depth":39,"text":2665},{"id":2920,"depth":39,"text":2921},"devops","guide","2026-07-15","This guide is a step-by-step reference on managing a `myapp.service` unit file.","md",null,"/knowledge-base/social-platforms.png",{},"/knowledge-base/systemd","10",{"title":5,"description":3136},{"loc":3141},"knowledge-base/systemd",[3147,3148],"Linux","Systemd","xOXQnq2BawQjUP93c6Ie24JvqWOaYZe0DagfjRdsuSc",[3151,3138],{"title":3152,"path":3153,"stem":3154,"children":-1},"SSH CookBook","/knowledge-base/ssh-recipe","knowledge-base/ssh-recipe",1784306722471]