Cyberpower – power panel

root@donkey:/data/software# dpkg -i powerpanel_132_amd64.deb

root@donkey:/data/software# pwrstat -status -test

The UPS information shows as following:

Properties:
    Model Name................... CP1000PFCLCD
    Firmware Number.............. 000000000000
    Rating Voltage............... 120 V
    Rating Power................. 600 Watt

Current UPS status:
    State........................ Normal
    Power Supply by.............. Utility Power
    Utility Voltage.............. 122 V
    Output Voltage............... 122 V
    Battery Capacity............. 100 %
    Remaining Runtime............ 36 min.
    Load......................... 102 Watt(17 %)
    Line Interaction............. None
    Test Result.................. Unknown
    Last Power Event............. None

root@donkey:/data/software# pwrstat -config

Daemon Configuration:

Alarm ………………………………………. On
Hibernate …………………………………… Off

Action for Power Failure:

Delay time since Power failure ............. 60 sec.
Run script command ......................... On
Path of script command ..................... /etc/pwrstatd-powerfail.sh
Duration of command running ................ 0 sec.
Enable shutdown system ..................... On

Action for Battery Low:

Remaining runtime threshold ................ 300 sec.
Battery capacity threshold ................. 35 %.
Run script command ......................... On
Path of command ............................ /etc/pwrstatd-lowbatt.sh
Duration of command running ................ 0 sec.
Enable shutdown system ..................... On


root@donkey:/data/software# pwrstat -config

Daemon Configuration:

Alarm ………………………………………. On
Hibernate …………………………………… Off

Action for Power Failure:

Delay time since Power failure ............. 60 sec.
Run script command ......................... On
Path of script command ..................... /etc/pwrstatd-powerfail.sh
Duration of command running ................ 0 sec.
Enable shutdown system ..................... On

Action for Battery Low:

Remaining runtime threshold ................ 300 sec.
Battery capacity threshold ................. 35 %.
Run script command ......................... On
Path of command ............................ /etc/pwrstatd-lowbatt.sh
Duration of command running ................ 0 sec.
Enable shutdown system ..................... On

root@donkey:/data/software# cat /etc/pwrstatd-powerfail.sh

!/bin/sh

echo “Warning: Utility power failure has occurred for a while, system will be shutdown soon!” | wall

export RECEIPT_NAME
export RECEIPT_ADDRESS
export SENDER_ADDRESS

#

If you want to receive event notification by e-mail, you must change ‘ENABLE_EMAIL’ item to ‘yes’.

Note: After change ‘ENABLE_EMAIL’ item, you must asign ‘RECEIPT_NAME’, ‘RECEIPT_ADDRESS’, and

‘SENDER_ADDRESS’ three items as below for the correct information.

#

Enable to send e-mail

ENABLE_EMAIL=yes

Change your name at this itme.

RECEIPT_NAME=”Jeremiah Jester”

Change mail receiver address at this itme.

RECEIPT_ADDRESS=jeremiahjester@gmail.com

Change mail sender address at this itme.

SENDER_ADDRESS=root@donkey.duckdns.org

Execute the ‘pwrstatd-email.sh’ shell script

if [ $ENABLE_EMAIL = yes ]; then
/etc/pwrstatd-email.sh
fi


Plex Media Scanner cmd line Error & fix

Error:

jjest@donkey:~$ sudo /usr/lib/plexmediaserver/Plex\ Media\ Scanner –list
/usr/lib/plexmediaserver/Plex Media Scanner: error while loading shared libraries: libboost_atomic.so.1.59.0: cannot open shared object file: No such file or directory

Resolution:

root@donkey:~# LD_LIBRARY_PATH=/usr/lib/plexmediaserver
You have new mail in /var/mail/root
root@donkey:~# PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=”/var/lib/plexmediaserver/Library/Application Support”
root@donkey:~# export LD_LIBRARY_PATH=/usr/lib/plexmediaserver
root@donkey:~# export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=”/var/lib/plexmediaserver/Library/Application Support”

Fixed!

Usage:

root@donkey:~# /usr/lib/plexmediaserver/Plex\ Media\ Scanner –list

3: House
1: Movies
5: Photos
2: Triplex
4: TV Shows
root@donkey:~# /usr/lib/plexmediaserver/Plex\ Media\ Scanner –progress –generate -c 2
Generated new media for Triplex Common 01 20190225103159.
Generated new media for Triplex Common 01 20190225120808.
Generated new media for Triplex Common 01 20190225121139.
Generated new media for Triplex Common 01 20190225121233.
Generated new media for Triplex Common 01 20190225122931.

check home disk usage script

# cat ./check_quotas.sh

!/bin/bash

day_max_limit=30 #int
home_dir_size_limit_bytes=1000000 #int
file_size_mb=10 #int

for host in ihop1; do
while read LINE; do
username=$(echo “$LINE” | cut -f1 -d”:”)
home_path=$(echo “$LINE” | cut -f6 -d”:” | egrep ‘(home|homes)’)
if [[ -e $home_path ]]; then
home_dir_size_bytes=$(du -s ${home_path} | cut -d ‘/’ -f 1 | tr -d [[:space:]] )
home_dir_size_mb=$(expr “$(($home_dir_size_bytes/1024))”)
if [[ “$home_dir_size_bytes” -gt “$home_dir_size_limit_bytes” ]]; then
cmd=$(find $home_path -ctime +${day_max_limit} -size +${file_size_mb}M -exec du -sh {} \;)
if [[ ! -z $cmd ]]; then
echo -e “Hi $username,\n\nYou’re home directory $home_path on $host is now ${home_dir_size_mb}M. This server is intended for temporary storage and will be purge every 30 days.\n”
#echo “” #echo $username@$host:$home_path
for file in $cmd; do
echo $file;
done
echo “”
fi
fi
fi
done < /etc/passwd
done