history -c
sudo su
echo “” > /var/log/apache2/error.log
for logs in `find /var/log -type f`; do > $logs; done
Kategori: Raspberry
Setting printer USB di Raspberry Pi
sudo chown www-data:www-data etc
sudo chmod 775 etc
sudo chown www-data:www-data /dev/usb/lp0
source:
https://www.howtogeek.com/169679/how-to-add-a-printer-to-your-raspberry-pi-or-other-linux-computer/
https://kernelmastery.com/enable-regular-users-to-add-printers-to-cups/
https://maker.pro/raspberry-pi/projects/how-to-turn-a-usb-printer-into-a-wireless-printer-with-raspberry-pi-zero-w
Setting printer serial di raspberry pi
sudo raspi-config
“Interfacing Options,” “Serial.” Turn OFF: login shell over serial, ENABLE: hardware serial port
“Interfacing Options,” enable SSH
sudo apt-get update
sudo apt-get install git cups wiringpi build-essential libcups2-dev libcupsimage2-dev python-serial python-pil python-unidecode
cd ~
git clone https://github.com/adafruit/zj-58
cd zj-58
make
sudo ./install
sudo usermod -a -G lp pi
sudo usermod -a -G lp www-data
reboot
sudo lpadmin -p ZJ-58 -E -v serial:/dev/serial0?baud=9600 -m zjiang/ZJ-58.ppd
sudo lpoptions -d ZJ-58
git clone https://github.com/adafruit/Python-Thermal-Printer
cd Python-Thermal-Printer
python printertest.py
sudo usermod -a -G dialout www-data
sudo usermod -a -G dialout pi
reboot
Membuat Daemon di Raspberry Pi
Buka terminal lalu ketik:
hciconfig hcitool scan
Nama perangkat biasanya bernama: hci0
Misalkan hasilnya adalah:
66:12:13:EE:D1:76 Bluetooth Printer
Test printer dengan perintah:
sudo rfcomm bind /dev/rfcomm0 66:12:13:EE:D1:76 1 echo “Test” > /dev/rfcomm0
Jika printer berhasil mencetak maka koneksi sudah berhasil
Selanjutnya tambahkan file untuk daemon service
sudo leafpad /etc/systemd/system/rfcomm.service
Ketik kode berikut dan simpan:
[Unit] Description=RFCOMM service After=bluetooth.service Requires=bluetooth.service [Service] ExecStart=/usr/bin/rfcomm bind hci0 66:12:13:EE:D1:76 1 [Install] WantedBy=multi-user.target
Ganti nama hci0 dengan nama hasil hciconfig dan ganti 66:12:13:EE:D1:76 dengan hasil hcitool scan
Aktifkan daemon, ubah preferensi printer dan booting
sudo systemctl enable rfcomm sudo systemctl start rfcomm Sudo reboot
Menambahkan RTC pada Raspberry Pi 3
Setting antarmuka I2C
sudo apt-get install -y python-smbus sudo apt-get install -y i2c-tools sudo raspi-config
Pilih Interfacing Option > I2C > Enable lanjutkan dengan booting. Selanjutnya test koneksi dengan perintah i2cdetect untuk antaruka I2C 1. (Cek juga antarmuka ke 0 jika perlu)
sudo i2cdetect -y 1 #isikan angka 1 bila mengunakan I2C1, isikan 0 bila menggunakan I2C 0

Setting RTC
sudo modprobe rtc-ds1307 #load rtc ke kernel sudo bash #masuk ke super user echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device #tambahkan device ds1307 di alamat 0x68 ke I2C1 exit #keluar dari super user sudo hwclock -r #baca waktu dari RTC sudo hwclock -w #tulis RTC berdasarkan sistem
Set agar waktu yang digunakan menggunakan RTC
sudo nano /etc/modules #agar modul rtc-ds1307 diload #tambahkan baris berikut: i2c-bcm2708 rtc-ds1307 sudo nano sudo nano /etc/rc.local #agar dijalankan saat booting #tambahkan baris berikut sebelum exit 0: echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device #tambahkan device ds1307 di alamat 0x68 ke I2C1 sudo hwclock -s #set waktu yang digunkan adalah RTC date #baca waktu saat ini dari RTC