LXC/Logrotate: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 14: Line 14:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
lxc image ls ubuntu:24.04
lxc image ls ubuntu:24.04
lxc rm -f    logrotate 2>/dev/null
lxc launch  ubuntu:24.04 logrotate
lxc launch  ubuntu:24.04 logrotate
lxc export  logrotate logrotate_ubuntu-20250523.tar.gz --optimized-storage
 
lxc delete  logrotate/ubuntu:24.04 2>/dev/null
lxc snapshot logrotate ubuntu:24.04
lxc export  logrotate logrotate_ubuntu-20250604.tar.gz --optimized-storage


lxc rm -f    logrotate 2>/dev/null
lxc rm -f    logrotate 2>/dev/null
lxc import  logrotate_ubuntu-20250523.tar.gz logrotate
lxc import  logrotate_ubuntu-20250604.tar.gz logrotate
lxc start    logrotate
lxc start    logrotate


lxc delete  logrotate/ubuntu:24.04 2>/dev/null
lxc snapshot logrotate ubuntu:24.04
lxc restore  logrotate ubuntu:24.04
lxc restore  logrotate ubuntu:24.04
lxc info    logrotate
lxc info    logrotate
Line 35: Line 37:
lxc delete  logrotate/faketime:0.9.10 2>/dev/null
lxc delete  logrotate/faketime:0.9.10 2>/dev/null
lxc snapshot logrotate faketime:0.9.10
lxc snapshot logrotate faketime:0.9.10
lxc export  logrotate logrotate_faketime-20250604.tar.gz --optimized-storage
lxc rm -f    logrotate 2>/dev/null
lxc import  logrotate_faketime-20250604.tar.gz logrotate
lxc start    logrotate
lxc restore  logrotate faketime:0.9.10
lxc restore  logrotate faketime:0.9.10
lxc info    logrotate
lxc info    logrotate

Revision as of 03:11, 4 June 2025

LXC » Logrotate » Alpine

lxc image ls images:alpine/3.21
lxc launch   images:alpine/3.21 logrotate
lxc export   logrotate logrotate_alpine-20250523.tar.gz --optimized-storage

lxc delete   logrotate/alpine:3.21 2>/dev/null
lxc snapshot logrotate alpine:3.21
lxc restore  logrotate alpine:3.21
lxc info     logrotate

LXC » Logrotate » Ubuntu

lxc image ls ubuntu:24.04
lxc rm -f    logrotate 2>/dev/null
lxc launch   ubuntu:24.04 logrotate

lxc delete   logrotate/ubuntu:24.04 2>/dev/null
lxc snapshot logrotate ubuntu:24.04
lxc export   logrotate logrotate_ubuntu-20250604.tar.gz --optimized-storage

lxc rm -f    logrotate 2>/dev/null
lxc import   logrotate_ubuntu-20250604.tar.gz logrotate
lxc start    logrotate

lxc restore  logrotate ubuntu:24.04
lxc info     logrotate

cat <<-'EXE'| lxc exec logrotate -- bash
echo;apt-get update;echo
apt-get install -y logrotate faketime;echo;apt-get clean
EXE

lxc delete   logrotate/faketime:0.9.10 2>/dev/null
lxc snapshot logrotate faketime:0.9.10
lxc export   logrotate logrotate_faketime-20250604.tar.gz --optimized-storage

lxc rm -f    logrotate 2>/dev/null
lxc import   logrotate_faketime-20250604.tar.gz logrotate
lxc start    logrotate

lxc restore  logrotate faketime:0.9.10
lxc info     logrotate

Playground

INET_PATH='.[].state.network.[].addresses[]|select(.family=="inet" and .scope=="global").address'
INET_ADDR=$(lxc list name=logrotate -f=yaml|yq  -r "${INET_PATH}")
apk cache clean
rm -vrf /var/cache/apk/*

References