Set Start Kiwix setiap Boot

From OnnoWiki
Revision as of 10:41, 22 November 2021 by 103.116.218.158 (talk) (Created page with "Agar kiwix dapat jalan secara otomatis setiap kali mesin/server di boot, kita perlu membuat script dan menambahkan di file /etc/rc.local . Langkah yang perlu dilakukan adalah,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Agar kiwix dapat jalan secara otomatis setiap kali mesin/server di boot, kita perlu membuat script dan menambahkan di file /etc/rc.local . Langkah yang perlu dilakukan adalah,

Buat shell script untuk menjalankan Kiwix di /root/ misalnya

sudo su nano /root/kiwix-jalan.sh

isi dengan,

cd /usr/local/src/kiwix-tools_linux-x86_64-3.1.2-5/ ./kiwix-serve --port=8080 wikipedia_id_top_maxi_2021-09.zim & ./kiwix-serve --port=8081 wiktionary_id_all_maxi_2021-08.zim &

save, dan pastikan bisa di run dengan perintah

sudo chmod 777 /root/kiwix-jalan.sh sudo chmod +x /root/kiwix-jalan.sh

Edit /etc/rc.local

sudo nano /etc/rc.local

Isi dengan

  1. !/bin/bash

/root/kiwix-jalan.sh exit 0

Save file rc.local dan beri ijin supaya dapat di execute,

sudo chmod +x /etc/rc.local

Edit /etc/systemd/system/rc-local.service:

sudo nano /etc/systemd/system/rc-local.service

tambahkan content berikut ke rc.local.service:

  1. SPDX-License-Identifier: LGPL-2.1+
  2. This file is part of systemd.
  3. systemd is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU Lesser General Public License by
  5. the Free Software Foundation; either version 2.1 of the License, or
  6. (at your option) any later version.
  7. This unit gets pulled automatically into multi-user.target by
  8. systemd-rc-local-generator if /etc/rc.local is executable.

[Unit] Description=/etc/rc.local Compatibility Documentation=man:systemd-rc-local-generator(8) ConditionFileIsExecutable=/etc/rc.local After=network.target

[Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 RemainAfterExit=yes GuessMainPID=no

[Install] WantedBy=multi-user.target

Enable rc.local by service:

sudo systemctl enable rc-local.service

Start rc.local by service:

sudo systemctl start rc-local.service

Check rc.local status:

sudo systemctl status rc-local.service