Cek temperature raspberry - Ubuntu
- Details
- Written by: Bayu Aji
- Category: OS
Check temperature :
cat /sys/class/thermal/thermal_zone0/temp
Kalau dalam bentuk script :
#!/bin/bash
temp=$(</sys/class/thermal/thermal_zone0/temp)
temp_f=`echo "$temp/1000" | bc -l`
printf "CPU Temp: %.3f°C\n" $temp_f
Instalasi memcache untuk support php fpm
- Details
- Written by: Bayu Aji
- Category: OS
1. Instal memcache
apt-get -y update
apt install memcached libmemcached-tools
2. Check memcached service
Karena memcached jalan otomatis maka tinggal di double check saja
sudo systemctl status memcached
3. Edit konfigurasi memcached jika diperlukan
sudo vi /etc/memcached.conf
Locate the -m parameter. Change its value to at least 1GB
Locate the -l parameter. Change its value to 127.0.0.1 or localhost
Install php fpm di ubuntu
- Details
- Written by: Bayu Aji
- Category: OS
PHP FPM (FastCGI Process Manager)
1. Install Apache dan lib
sudo apt update
sudo apt install apache2 libapache2-mod-fcgid -y
2. Install php dan php-fm
sudo apt install php php-fpm -y
3. Check php-fm servis
sudo systemctl status php7.4-fpm
4. Mengaktifkan module yang dibutuhkan
sudo a2enmod actions fcgid alias proxy_fcgi
Sedikit trik copy (cp) pada Ubuntu
- Details
- Written by: Bayu Aji
- Category: OS
Berawal dari keinginan copy semua file kecuali file/folder tertentu melalui command line, akhirnya tahu beberapa trik yang cukup berguna. Yaitu
cp -rp !(Default.png) /source /dest
artinya: copy semua file termasuk folder dari folder source ke folder dest kecuali Default.png
Kalau munculnya error :
bash: !: event not found
Berarti butuh aktifkan extglob :
sudo shopt -s extglob
detail apa arti detail perintah diatas bisa dipelajari disini.
Oh ya untuk pembuatan script bash jangan lupa kasih script berikut di bagian paling atas :
#!/usr/bin/bash
shopt -s extglob
Untuk lokasi bash disesuaikan saja, bisa dicari lokasinya dengan perintah "which bash"
Alternatif yang lain adalah pakai find
# Simple, if src/ only contains files:
find src/ ! -name Default.png -exec cp -t dest/ {} +
# If src/ has sub-directories, this omits them, but does copy files inside of them:
find src/ -type f ! -name Default.png -exec cp -t dest/ {} +
# If src/ has sub-directories, this does not recurse into them:
find src/ -type f -maxdepth 1 ! -name Default.png -exec cp -t dest/ {} +
Page 18 of 69