Raspberry pi cleanup script

Create with the following command in your raspberry pi the script.

sudo nano cleanup.sh

Paste below the text and with CTRL + X close nano

#!/bin/bash
 
OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)"
METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)
YELLOW="\033[1;33m"
RED="\033[0;31m"
ENDCOLOR="\033[0m"
 
if [ $USER != root ]; then
echo -e $RED"Error: must be root"
echo -e $YELLOW"Exiting..."$ENDCOLOR
exit 0
fi
 
echo -e $YELLOW"Cleaning apt cache..."$ENDCOLOR
aptitude clean
 
echo -e $YELLOW"Removing old config files..."$ENDCOLOR
sudo aptitude purge $OLDCONF
 
echo -e $YELLOW"Removing old kernels..."$ENDCOLOR
sudo aptitude purge $OLDKERNELS
 
echo -e $YELLOW"Emptying every trashes..."$ENDCOLOR
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
rm -rf /root/.local/share/Trash/*/** &> /dev/null
 
echo -e $YELLOW"Script Finished!"$ENDCOLOR

To run the script. First:

sudo chmod 777 cleanup.sh

Start the cleanup:

Sudo ./cleanup.sh

 

Assign ip to VPN connecton on synology nas

Uitgaande van een standaard installatie van het VPN Server package:

Navigeer naar

/usr/syno/etc/packages/VPNCenter/Maak daarin een map aan met de naam

ccdRechten ccd: 0755
Maak in die map een bestand aan met de naam van de gebruiker die het vaste tunnel IP moet krijgen, b.v.

adminSchrijf in dat bestand

ifconfig-push 10.8.0.6 10.8.0.5Rechten admin: 0644

Navigeer naar

/usr/syno/etc/packages/VPNCenter/openvpnOpen

openvpn.confen voeg de regel

client-config-dir /usr/syno/etc/packages/VPNCenter/ccdtoe.

Navigeer naar

/volume1/@appstore/VPNCenter/etc/openvpnopen

radiusplugin.cnfen wijzig

overwriteccfiles=truein

overwriteccfiles=false
Start/Herstart OpenVPN.

Bron: synology-forum.nl