...
HISTFILESIZE=
HISTSIZE=
HISTTIMEFORMAT="[%F %T] "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
HISTFILE=~/.bash_eternal_history
# Force prompt to write history after every command.
# http://superuser.com/questions/20900/bash-history-loss
PROMPT_COMMAND="history -a; ${PROMPT_COMMAND:-true}"
# Log last command to syslog
log_command () {
echo "${USER} $(HISTTIMEFORMAT='' builtin history 1|cut -c8-)" | logger -t shell -p user.info
}
PROMPT_COMMAND="${PROMPT_COMMAND:-true};log_command"
/etc/skel/.bashrc und /root/.bashrc und /home/ubuntu/.bashrc
Bislang:
1234
...
HISTSIZE=1000
HISTFILESIZE=2000
...
Neu:
1234
...
#HISTSIZE=1000
#HISTFILESIZE=2000
...
Zeitzone korrigieren
12345
root@ubuntu-1804:~# date
Mon Apr 8 04:59:43 UTC 2019
root@ubuntu-1804:~# timedatectl set-timezone Europe/Berlin
root@ubuntu-1804:~# date
Mon Apr 8 07:00:21 CEST 2019
Apt-Cacher-NG vom LXDHOST aktivieren
/root/bin/apt-proxy.sh
12345678910111213141516
#!/bin/sh
# port of apt-cacher-ng on the lxd host
PORT=3142
APT_PROXY_FILE="/etc/apt/apt.conf.d/01proxy"
LXDHOST=
for h in $(ip addr|grep -o "inet [0-9.]*/"|grep -v 127.0.0.1|grep -o "[0-9.]*"|sed -e "s/[.][0-9]*$/.1/"); do
nc -z "${h}" "${PORT}" && { LXDHOST="${h}"; break; }
done
if [ -n "${LXDHOST}" ]; then
echo >"${APT_PROXY_FILE}" "Acquire::http::Proxy \"http://${LXDHOST}:${PORT}\";"
else
rm -f "${APT_PROXY_FILE}"
fi
/root/systemd/apt-proxy.service
123456789101112
[Unit]
Description=Apt proxy to apt-cacher-ng on lxd host
After=network.target
[Service]
ExecStart=/root/bin/apt-proxy.sh
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Aktivieren
123
lxdhost# systemctl enable /root/systemd/apt-proxy.service
Created symlink /etc/systemd/system/multi-user.target.wants/apt-proxy.service → /root/systemd/apt-proxy.service.
Created symlink /etc/systemd/system/apt-proxy.service → /root/systemd/apt-proxy.service.
Test
1234567891011
lxdhost# reboot
...
lxdhost# systemctl status apt-proxy
● apt-proxy.service - Apt proxy to apt-cacher-ng on lxd host
Loaded: loaded (/root/systemd/apt-proxy.service; enabled; vendor preset: enabled)
Active: active (exited) since Sun 2019-12-08 07:10:09 CET; 12min ago
Process: 217 ExecStart=/root/bin/apt-proxy.sh (code=exited, status=0/SUCCESS)
Main PID: 217 (code=exited, status=0/SUCCESS)
Dec 08 07:10:09 hostonly systemd[1]: apt-proxy.service: Failed to reset devices.list: Operation not permitted
Dec 08 07:10:09 hostonly systemd[1]: Started Apt proxy to apt-cacher-ng on lxd host.
Änderungshistorie
2019-12-08: Apt-Cacher-NG
2019-04-29: Bash-Historie in /var/log/syslog speichern