Latihan 1 dari materi Systemd & Service Management di DevOps — praktek dengan editor kode interaktif, test case otomatis, dan hint terpandu. Langsung jalan di browser.
Buat fungsi generateUnitFile(config) yang menerima object dan mengembalikan string systemd unit file.
Config: { description, execStart, user, restart, after } dimana after adalah array string.
Format output:
[Unit]
Description={description}
After={after joined space}
[Service]
Type=simple
User={user}
ExecStart={execStart}
Restart={restart}
[Install]
WantedBy=multi-user.target
Jika after kosong array, skip baris After=.