XYZ File Manager
Current Path:
/usr/bin
usr
/
bin
/
📁
..
📁
X11
📄
[
(66.89 KB)
📄
ab
(58.42 KB)
📄
addpart
(30.31 KB)
📄
apt
(18.31 KB)
📄
apt-cache
(86.38 KB)
📄
apt-cdrom
(22.38 KB)
📄
apt-config
(26.31 KB)
📄
apt-get
(50.38 KB)
📄
apt-key
(27.32 KB)
📄
apt-mark
(58.38 KB)
📄
arch
(42.86 KB)
📄
awk
(154.66 KB)
📄
b2sum
(58.98 KB)
📄
base32
(46.89 KB)
📄
base64
(46.89 KB)
📄
basename
(42.83 KB)
📄
basenc
(54.89 KB)
📄
bash
(1.21 MB)
📄
bashbug
(6.7 KB)
📄
bdftopcf
(42.45 KB)
📄
bdftruncate
(10.22 KB)
📄
busctl
(90.5 KB)
📄
c_rehash
(6.68 KB)
📄
captoinfo
(90.34 KB)
📄
cat
(42.98 KB)
📄
certbot
(958 B)
📄
chage
(78.49 KB)
📄
chardet
(221 B)
📄
chardetect
(221 B)
📄
chattr
(14.24 KB)
📄
chcon
(67.11 KB)
📄
checkgid
(14.23 KB)
📄
chfn
(61.2 KB)
📄
chgrp
(67.05 KB)
📄
chmod
(62.98 KB)
📄
choom
(54.31 KB)
📄
chown
(71.05 KB)
📄
chrt
(66.31 KB)
📄
chsh
(51.64 KB)
📄
cksum
(139.05 KB)
📄
clear
(14.24 KB)
📄
clear_console
(14.15 KB)
📄
cmp
(50.95 KB)
📄
comm
(46.92 KB)
📄
corelist
(15.01 KB)
📄
cp
(147.61 KB)
📄
cpan
(8.16 KB)
📄
cpan5.36-x86_64-linux-gnu
(8.18 KB)
📄
csplit
(119.17 KB)
📄
ctstat
(26.59 KB)
📄
cut
(46.98 KB)
📄
dash
(122.7 KB)
📄
date
(119.05 KB)
📄
dbus-cleanup-sockets
(14.22 KB)
📄
dbus-daemon
(238.56 KB)
📄
dbus-monitor
(26.23 KB)
📄
dbus-run-session
(14.23 KB)
📄
dbus-send
(30.22 KB)
📄
dbus-update-activation-environment
(14.22 KB)
📄
dbus-uuidgen
(14.22 KB)
📄
dd
(87.15 KB)
📄
deb-systemd-helper
(23.79 KB)
📄
deb-systemd-invoke
(6.09 KB)
📄
debconf
(2.79 KB)
📄
debconf-apt-progress
(11.27 KB)
📄
debconf-communicate
(608 B)
📄
debconf-copydb
(1.68 KB)
📄
debconf-escape
(647 B)
📄
debconf-set-selections
(2.92 KB)
📄
debconf-show
(1.78 KB)
📄
delpart
(30.31 KB)
📄
df
(99.8 KB)
📄
dialog
(247.85 KB)
📄
diff
(151.58 KB)
📄
diff3
(67.14 KB)
📄
dir
(147.8 KB)
📄
dircolors
(50.92 KB)
📄
dirname
(38.83 KB)
📄
dmesg
(86.58 KB)
📄
dnsdomainname
(22.15 KB)
📄
domainname
(22.15 KB)
📄
dpkg
(310.64 KB)
📄
dpkg-deb
(166.52 KB)
📄
dpkg-divert
(154.55 KB)
📄
dpkg-maintscript-helper
(20.71 KB)
📄
dpkg-query
(158.58 KB)
📄
dpkg-realpath
(4.09 KB)
📄
dpkg-split
(126.48 KB)
📄
dpkg-statoverride
(62.33 KB)
📄
dpkg-trigger
(86.48 KB)
📄
du
(171.33 KB)
📄
dvipdf
(1007 B)
📄
echo
(42.83 KB)
📄
editor
(3.48 MB)
📄
egrep
(41 B)
📄
enc2xs
(40.96 KB)
📄
encguess
(3 KB)
📄
env
(47.4 KB)
📄
eps2eps
(639 B)
📄
ex
(3.48 MB)
📄
expand
(42.92 KB)
📄
expiry
(30.45 KB)
📄
expr
(115.05 KB)
📄
factor
(83.2 KB)
📄
faillog
(22.53 KB)
📄
fallocate
(34.31 KB)
📄
false
(34.83 KB)
📄
fcgistarter
(14.23 KB)
📄
fgrep
(41 B)
📄
fincore
(34.36 KB)
📄
find
(219.58 KB)
📄
findmnt
(83.59 KB)
📄
flock
(34.39 KB)
📄
fmt
(46.89 KB)
📄
fold
(42.89 KB)
📄
fonttosfnt
(34.41 KB)
📄
free
(26.3 KB)
📄
fuser
(39.83 KB)
📄
getconf
(26.5 KB)
📄
getent
(35.47 KB)
📄
getopt
(34.31 KB)
📄
ghostscript
(14.23 KB)
📄
gpasswd
(86.42 KB)
📄
gpgv
(463 KB)
📄
grep
(198.39 KB)
📄
groups
(42.89 KB)
📄
gs
(14.23 KB)
📄
gsbj
(350 B)
📄
gsdj
(352 B)
📄
gsdj500
(352 B)
📄
gslj
(353 B)
📄
gslp
(350 B)
📄
gsnd
(277 B)
📄
gunzip
(2.29 KB)
📄
gzexe
(6.3 KB)
📄
gzip
(95.84 KB)
📄
h2ph
(28.54 KB)
📄
h2xs
(59.51 KB)
📄
hardlink
(50.39 KB)
📄
head
(46.95 KB)
📄
helpztags
(2.46 KB)
📄
hostid
(38.83 KB)
📄
hostname
(22.15 KB)
📄
hostnamectl
(30.38 KB)
📄
htcacheclean
(34.24 KB)
📄
htdbm
(26.23 KB)
📄
htdigest
(14.23 KB)
📄
htpasswd
(26.23 KB)
📄
i386
(26.58 KB)
📄
iconv
(63.13 KB)
📄
id
(47.02 KB)
📄
infocmp
(62.31 KB)
📄
infotocap
(90.34 KB)
📄
install
(155.8 KB)
📄
instmodsh
(4.27 KB)
📄
ionice
(34.31 KB)
📄
ip
(674.82 KB)
📄
ipcmk
(34.38 KB)
📄
ipcrm
(34.31 KB)
📄
ipcs
(74.31 KB)
📄
ischroot
(14.32 KB)
📄
join
(54.98 KB)
📄
journalctl
(74.64 KB)
📄
json_pp
(4.88 KB)
📄
kernel-install
(12.75 KB)
📄
kill
(22.3 KB)
📄
killall
(31.95 KB)
📄
last
(50.31 KB)
📄
lastb
(50.31 KB)
📄
lastlog
(31.75 KB)
📄
lcf
(7.6 KB)
📄
ld.so
(205.96 KB)
📄
ldd
(5.28 KB)
📄
letsencrypt
(958 B)
📄
libnetcfg
(15.41 KB)
📄
link
(38.83 KB)
📄
linux32
(26.58 KB)
📄
linux64
(26.58 KB)
📄
ln
(71.12 KB)
📄
lnstat
(26.59 KB)
📄
locale
(46.16 KB)
📄
localectl
(26.38 KB)
📄
localedef
(291.91 KB)
📄
logger
(54.9 KB)
📄
login
(51.78 KB)
📄
loginctl
(58.48 KB)
📄
logname
(38.83 KB)
📄
logresolve
(14.24 KB)
📄
ls
(147.8 KB)
📄
lsattr
(14.24 KB)
📄
lsb_release
(2.59 KB)
📄
lsblk
(202.31 KB)
📄
lscpu
(126.31 KB)
📄
lsfd
(120.3 KB)
📄
lsipc
(98.31 KB)
📄
lsirq
(34.48 KB)
📄
lslocks
(70.7 KB)
📄
lslogins
(94.31 KB)
📄
lsmem
(66.31 KB)
📄
lsns
(82.31 KB)
📄
mawk
(154.66 KB)
📄
mcookie
(34.38 KB)
📄
md5sum
(50.95 KB)
📄
md5sum.textutils
(50.95 KB)
📄
mesg
(18.3 KB)
📄
mkdir
(95.27 KB)
📄
mkfifo
(67.17 KB)
📄
mkfontdir
(65 B)
📄
mkfontscale
(39.05 KB)
📄
mknod
(71.2 KB)
📄
mktemp
(42.92 KB)
📄
more
(58.31 KB)
📄
mount
(58.3 KB)
📄
mountpoint
(18.3 KB)
📄
mv
(139.62 KB)
📄
namei
(34.31 KB)
📄
nawk
(154.66 KB)
📄
netstat
(151.66 KB)
📄
networkctl
(106.38 KB)
📄
newgrp
(47.75 KB)
📄
nice
(42.86 KB)
📄
nisdomainname
(22.15 KB)
📄
nl
(111.11 KB)
📄
nohup
(42.89 KB)
📄
normalizer
(244 B)
📄
nproc
(42.89 KB)
📄
nsenter
(34.54 KB)
📄
nstat
(104.45 KB)
📄
numfmt
(67.02 KB)
📄
od
(79.02 KB)
📄
openssl
(953.26 KB)
📄
pager
(58.31 KB)
📄
paperconf
(14.34 KB)
📄
partx
(118.31 KB)
📄
passwd
(66.65 KB)
📄
paste
(42.89 KB)
📄
pathchk
(42.86 KB)
📄
pdb3
(62.4 KB)
📄
pdb3.11
(62.4 KB)
📄
pdf2dsc
(698 B)
📄
pdf2ps
(909 B)
📄
peekfd
(14.5 KB)
📄
perl
(3.63 MB)
📄
perl5.36-x86_64-linux-gnu
(14.41 KB)
📄
perl5.36.0
(3.63 MB)
📄
perlbug
(44.12 KB)
📄
perldoc
(125 B)
📄
perlivp
(10.61 KB)
📄
perlthanks
(44.12 KB)
📄
pf2afm
(498 B)
📄
pfbtopfa
(516 B)
📄
pgrep
(34.42 KB)
📄
phar
(14.88 KB)
📄
phar.phar
(14.88 KB)
📄
phar.phar8.2
(14.88 KB)
📄
phar8.2
(14.88 KB)
📄
phar8.2.phar
(14.88 KB)
📄
php
(5.4 MB)
📄
php8.2
(5.4 MB)
📄
piconv
(8.16 KB)
📄
pidof
(26.31 KB)
📄
pidwait
(34.42 KB)
📄
pinky
(47.05 KB)
📄
pkill
(34.42 KB)
📄
pl2pm
(4.43 KB)
📄
pldd
(22.69 KB)
📄
pmap
(34.34 KB)
📄
pod2html
(4.04 KB)
📄
pod2man
(14.68 KB)
📄
pod2text
(10.55 KB)
📄
pod2usage
(4.01 KB)
📄
podchecker
(3.57 KB)
📄
pphs
(404 B)
📄
pr
(79.11 KB)
📄
printafm
(395 B)
📄
printenv
(34.83 KB)
📄
printf
(62.92 KB)
📄
prlimit
(38.83 KB)
📄
prove
(13.34 KB)
📄
prtstat
(18.57 KB)
📄
ps
(142.93 KB)
📄
ps2ascii
(631 B)
📄
ps2epsi
(1.23 KB)
📄
ps2pdf
(272 B)
📄
ps2pdf12
(215 B)
📄
ps2pdf13
(215 B)
📄
ps2pdf14
(215 B)
📄
ps2pdfwr
(1.05 KB)
📄
ps2ps
(647 B)
📄
ps2ps2
(669 B)
📄
ps2txt
(631 B)
📄
pslog
(14.45 KB)
📄
pstree
(35.78 KB)
📄
pstree.x11
(35.78 KB)
📄
ptar
(3.48 KB)
📄
ptardiff
(2.58 KB)
📄
ptargrep
(4.29 KB)
📄
ptx
(135.23 KB)
📄
pwd
(42.92 KB)
📄
pwdx
(14.3 KB)
📄
py3clean
(7.63 KB)
📄
py3compile
(13 KB)
📄
py3versions
(12.52 KB)
📄
pydoc3
(79 B)
📄
pydoc3.11
(79 B)
📄
pygettext3
(23.67 KB)
📄
pygettext3.11
(23.67 KB)
📄
python3
(6.52 MB)
📄
python3.11
(6.52 MB)
📄
rbash
(1.21 MB)
📄
rdma
(180.6 KB)
📄
readlink
(50.89 KB)
📄
realpath
(50.92 KB)
📄
rename.ul
(22.3 KB)
📄
renice
(14.3 KB)
📄
reset
(30.24 KB)
📄
resizepart
(70.31 KB)
📄
rev
(14.3 KB)
📄
rgrep
(30 B)
📄
rm
(71.05 KB)
📄
rmdir
(54.92 KB)
📄
rotatelogs
(26.31 KB)
📄
routel
(1.62 KB)
📄
rtstat
(26.59 KB)
📄
run-parts
(26.91 KB)
📄
runcon
(42.95 KB)
📄
rview
(3.48 MB)
📄
rvim
(3.48 MB)
📄
savelog
(10.24 KB)
📄
scp
(266.63 KB)
📄
script
(70.3 KB)
📄
scriptlive
(54.3 KB)
📄
scriptreplay
(46.3 KB)
📄
sdiff
(55.08 KB)
📄
sed
(123.46 KB)
📄
select-editor
(2.39 KB)
📄
sensible-browser
(1.26 KB)
📄
sensible-editor
(1.24 KB)
📄
sensible-pager
(565 B)
📄
seq
(58.92 KB)
📄
setarch
(26.58 KB)
📄
setpriv
(78.31 KB)
📄
setsid
(14.3 KB)
📄
setterm
(46.31 KB)
📄
sftp
(282.59 KB)
📄
sg
(47.75 KB)
📄
sh
(122.7 KB)
📄
sha1sum
(54.95 KB)
📄
sha224sum
(58.95 KB)
📄
sha256sum
(58.95 KB)
📄
sha384sum
(62.95 KB)
📄
sha512sum
(62.95 KB)
📄
shasum
(9.75 KB)
📄
shred
(63.14 KB)
📄
shuf
(58.98 KB)
📄
skill
(30.33 KB)
📄
slabtop
(22.37 KB)
📄
sleep
(42.86 KB)
📄
slogin
(1.07 MB)
📄
snice
(30.33 KB)
📄
sort
(115.68 KB)
📄
splain
(18.99 KB)
📄
split
(59.55 KB)
📄
ss
(189.14 KB)
📄
ssh
(1.07 MB)
📄
ssh-add
(518.44 KB)
📄
ssh-agent
(474.38 KB)
📄
ssh-argv0
(1.42 KB)
📄
ssh-copy-id
(12.38 KB)
📄
ssh-keygen
(646.44 KB)
📄
ssh-keyscan
(622.47 KB)
📄
stat
(95.2 KB)
📄
stdbuf
(58.92 KB)
📄
streamzip
(7.75 KB)
📄
stty
(83.02 KB)
📄
su
(70.31 KB)
📄
sum
(50.96 KB)
📄
sync
(38.89 KB)
📄
systemctl
(1.29 MB)
📄
systemd
(90.38 KB)
📄
systemd-analyze
(182.61 KB)
📄
systemd-ask-password
(18.48 KB)
📄
systemd-cat
(18.38 KB)
📄
systemd-cgls
(22.48 KB)
📄
systemd-cgtop
(38.4 KB)
📄
systemd-creds
(42.61 KB)
📄
systemd-cryptenroll
(58.6 KB)
📄
systemd-delta
(26.38 KB)
📄
systemd-detect-virt
(18.37 KB)
📄
systemd-escape
(18.37 KB)
📄
systemd-firstboot
(50.59 KB)
📄
systemd-id128
(22.37 KB)
📄
systemd-inhibit
(22.39 KB)
📄
systemd-machine-id-setup
(18.48 KB)
📄
systemd-mount
(50.59 KB)
📄
systemd-notify
(18.38 KB)
📄
systemd-path
(18.37 KB)
📄
systemd-repart
(150.69 KB)
📄
systemd-run
(58.57 KB)
📄
systemd-socket-activate
(26.38 KB)
📄
systemd-stdio-bridge
(18.38 KB)
📄
systemd-sysext
(42.49 KB)
📄
systemd-sysusers
(62.68 KB)
📄
systemd-tmpfiles
(110.57 KB)
📄
systemd-tty-ask-password-agent
(34.38 KB)
📄
systemd-umount
(50.59 KB)
📄
tabs
(18.23 KB)
📄
tac
(111.05 KB)
📄
tail
(75.14 KB)
📄
tar
(519.52 KB)
📄
taskset
(62.31 KB)
📄
tee
(42.95 KB)
📄
tempfile
(14.18 KB)
📄
test
(58.89 KB)
📄
tic
(90.34 KB)
📄
timedatectl
(42.37 KB)
📄
timeout
(47.49 KB)
📄
tload
(18.32 KB)
📄
toe
(22.23 KB)
📄
top
(131.58 KB)
📄
touch
(107.05 KB)
📄
tput
(26.27 KB)
📄
tr
(54.89 KB)
📄
true
(34.83 KB)
📄
truncate
(42.89 KB)
📄
tset
(30.24 KB)
📄
tsort
(54.89 KB)
📄
tty
(34.86 KB)
📄
tzselect
(14.99 KB)
📄
ucf
(40.69 KB)
📄
ucfq
(18.91 KB)
📄
ucfr
(10.85 KB)
📄
uclampset
(62.31 KB)
📄
ucs2any
(18.32 KB)
📄
umount
(34.3 KB)
📄
uname
(42.86 KB)
📄
uncompress
(2.29 KB)
📄
unexpand
(42.92 KB)
📄
uniq
(46.95 KB)
📄
unlink
(38.83 KB)
📄
unshare
(82.54 KB)
📄
update-alternatives
(58.31 KB)
📄
update-mime-database
(59.27 KB)
📄
uptime
(14.3 KB)
📄
users
(38.89 KB)
📄
utmpdump
(30.3 KB)
📄
vdir
(147.8 KB)
📄
vi
(3.48 MB)
📄
view
(3.48 MB)
📄
vim
(3.48 MB)
📄
vim.basic
(3.48 MB)
📄
vimdiff
(3.48 MB)
📄
vimtutor
(2.1 KB)
📄
vmstat
(34.72 KB)
📄
w
(22.3 KB)
📄
wall
(38.3 KB)
📄
watch
(26.71 KB)
📄
wc
(51.05 KB)
📄
wdctl
(70.34 KB)
📄
wget
(527.36 KB)
📄
whereis
(30.77 KB)
📄
which
(946 B)
📄
which.debianutils
(946 B)
📄
who
(59.02 KB)
📄
whoami
(38.86 KB)
📄
x86_64
(26.58 KB)
📄
xargs
(70.45 KB)
📄
xdg-user-dir
(234 B)
📄
xdg-user-dirs-update
(26.16 KB)
📄
xsubpp
(5.05 KB)
📄
xxd
(18.21 KB)
📄
yes
(38.83 KB)
📄
ypdomainname
(22.15 KB)
📄
zcat
(1.94 KB)
📄
zcmp
(1.64 KB)
📄
zdiff
(6.31 KB)
📄
zdump
(22.52 KB)
📄
zegrep
(29 B)
📄
zfgrep
(29 B)
📄
zforce
(2.03 KB)
📄
zgrep
(7.91 KB)
📄
zipdetails
(68.55 KB)
📄
zless
(2.15 KB)
📄
zmore
(1.8 KB)
📄
znew
(4.47 KB)
Editing: savelog
#! /bin/sh # savelog - save a log file # Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll # Copyright (C) 1992 Ronald S. Karr # Slight modifications by Ian A. Murdock <imurdock@gnu.ai.mit.edu>: # * uses `gzip' rather than `compress' # * doesn't use $savedir; keeps saved log files in the same directory # * reports successful rotation of log files # * for the sake of consistency, files are rotated even if they are # empty # More modifications by Guy Maor <maor@debian.org>: # * cleanup. # * -p (preserve) option # # usage: savelog [-m mode] [-u user] [-g group] [-t] [-p] [-c cycle] # [-j] [-C] [-d] [-l] [-r rolldir] [-n] [-q] file... # -m mode - chmod log files to mode # -u user - chown log files to user # -g group - chgrp log files to group # -c cycle - save cycle versions of the logfile (default: 7) # -r rolldir- use rolldir instead of . to roll files # -C - force cleanup of cycled logfiles # -d - use standard date for rolling # -D - override date format for -d # -t - touch file # -l - don't compress any log files (default: compress) # -p - preserve mode/user/group of original file # -j - use bzip2 instead of gzip # -J - use xz instead of gzip # -1 .. -9 - compression strength or memory usage (default: 9, except for xz) # -x script - invoke script with rotated log file in $FILE # -n - do not rotate empty files # -q - be quiet # file - log file names # # The savelog command saves and optionally compresses old copies of files. # Older version of 'file' are named: # # 'file'.<number><compress_suffix> # # where <number> is the version number, 0 being the newest. By default, # version numbers > 0 are compressed (unless -l prevents it). The # version number 0 is never compressed on the off chance that a process # still has 'file' opened for I/O. # # if the '-d' option is specified, <number> will be YYMMDDhhmmss # # If the 'file' does not exist and -t was given, it will be created. # # For files that do exist and have lengths greater than zero, the following # actions are performed. # # 1) Version numered files are cycled. That is version 6 is moved to # version 7, version is moved to becomes version 6, ... and finally # version 0 is moved to version 1. Both compressed names and # uncompressed names are cycled, regardless of -t. Missing version # files are ignored. # # 2) The new file.1 is compressed and is changed subject to # the -m, -u and -g flags. This step is skipped if the -t flag # was given. # # 3) The main file is moved to file.0. # # 4) If the -m, -u, -g, -t, or -p flags are given, then the file is # touched into existence subject to the given flags. The -p flag # will preserve the original owner, group, and permissions. # # 5) The new file.0 is changed subject to the -m, -u and -g flags. # # Note: If no -m, -u, -g, -t, or -p is given, then the primary log file is # not created. # # Note: Since the version numbers start with 0, version number <cycle> # is never formed. The <cycle> count must be at least 2. # # Bugs: If a process is still writing to the file.0 and savelog # moved it to file.1 and compresses it, data could be lost. # Smail does not have this problem in general because it # restats files often. # common location export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin COMPRESS="gzip" COMPRESS_OPTS="-f" COMPRESS_STRENGTH_DEF="-9"; DOT_Z=".gz" DATUM=`date +%Y%m%d%H%M%S` # parse args exitcode=0 # no problems to far prog=`basename $0` mode= user= group= touch= forceclean= rolldir= datum= preserve= hookscript= quiet=0 rotateifempty=yes count=7 usage() { echo "Usage: $prog [-m mode] [-u user] [-g group] [-t] [-c cycle] [-p]" echo " [-j] [-C] [-d] [-l] [-r rolldir] [-n] [-q] file ..." echo " -m mode - chmod log files to mode" echo " -u user - chown log files to user" echo " -g group - chgrp log files to group" echo " -c cycle - save cycle versions of the logfile (default: 7)" echo " -r rolldir - use rolldir instead of . to roll files" echo " -C - force cleanup of cycled logfiles" echo " -d - use standard date for rolling" echo " -D - override date format for -d" echo " -t - touch file" echo " -l - don't compress any log files (default: compress)" echo " -p - preserve mode/user/group of original file" echo " -j - use bzip2 instead of gzip" echo " -J - use xz instead of gzip" echo " -1 .. -9 - compression strength or memory usage (default: 9, except for xz)" echo " -x script - invoke script with rotated log file in \$FILE" echo " -n - do not rotate empty files" echo " -q - suppress rotation message" echo " file - log file names" } fixfile() { if [ -n "$user" ]; then chown -- "$user" "$1" fi if [ -n "$group" ]; then chgrp -- "$group" "$1" fi if [ -n "$mode" ]; then chmod -- "$mode" "$1" fi } while getopts m:u:g:c:r:CdD:tlphjJ123456789x:nq opt ; do case "$opt" in m) mode="$OPTARG" ;; u) user="$OPTARG" ;; g) group="$OPTARG" ;; c) count="$OPTARG" ;; r) rolldir="$OPTARG" ;; C) forceclean=1 ;; d) datum=1 ;; D) DATUM=$(date +$OPTARG) ;; t) touch=1 ;; j) COMPRESS="bzip2"; COMPRESS_OPTS="-f"; COMPRESS_STRENGTH_DEF="-9"; DOT_Z=".bz2" ;; J) COMPRESS="xz"; COMPRESS_OPTS="-f"; COMPRESS_STRENGTH_DEF=""; DOT_Z=".xz" ;; [1-9]) COMPRESS_STRENGTH="-$opt" ;; x) hookscript="$OPTARG" ;; l) COMPRESS="" ;; p) preserve=1 ;; n) rotateifempty="no" ;; q) quiet=1 ;; h) usage; exit 0 ;; *) usage; exit 1 ;; esac done shift $(($OPTIND - 1)) if [ "$count" -lt 2 ]; then echo "$prog: count must be at least 2" 1>&2 exit 2 fi if [ -n "$COMPRESS" ] && [ -z "$(command -v $COMPRESS)" ]; then echo "$prog: Compression binary not available, please make sure '$COMPRESS' is installed" 1>&2 exit 2 fi if [ -n "$COMPRESS_STRENGTH" ]; then COMPRESS_OPTS="$COMPRESS_OPTS $COMPRESS_STRENGTH" else COMPRESS_OPTS="$COMPRESS_OPTS $COMPRESS_STRENGTH_DEF" fi # cycle thru filenames while [ $# -gt 0 ]; do # get the filename filename="$1" shift # catch bogus files if [ -e "$filename" ] && [ ! -f "$filename" ]; then echo "$prog: $filename is not a regular file" 1>&2 exitcode=3 continue fi # if file does not exist or is empty, and we've been told to not rotate # empty files, create if requested and skip to the next file. if [ ! -s "$filename" ] && [ "$rotateifempty" = "no" ]; then # if -t was given and it does not exist, create it if test -n "$touch" && [ ! -f "$filename" ]; then touch -- "$filename" if [ "$?" -ne 0 ]; then echo "$prog: could not touch $filename" 1>&2 exitcode=4 continue fi fixfile "$filename" fi continue # otherwise if the file does not exist and we've been told to rotate it # anyway, create an empty file to rotate. elif [ ! -e "$filename" ]; then touch -- "$filename" if [ "$?" -ne 0 ]; then echo "$prog: could not touch $filename" 1>&2 exitcode=4 continue fi fixfile "$filename" fi # be sure that the savedir exists and is writable # (Debian default: $savedir is . and not ./OLD) savedir=`dirname -- "$filename"` if [ -z "$savedir" ]; then savedir=. fi case "$rolldir" in (/*) savedir="$rolldir" ;; (*) savedir="$savedir/$rolldir" ;; esac if [ ! -d "$savedir" ]; then mkdir -p -- "$savedir" if [ "$?" -ne 0 ]; then echo "$prog: could not mkdir $savedir" 1>&2 exitcode=5 continue fi chmod 0755 -- "$savedir" fi if [ ! -w "$savedir" ]; then echo "$prog: directory $savedir is not writable" 1>&2 exitcode=7 continue fi # determine our uncompressed file names newname=`basename -- "$filename"` newname="$savedir/$newname" # cycle the old compressed log files cycle=$(( $count - 1)) rm -f -- "$newname.$cycle" "$newname.$cycle$DOT_Z" while [ $cycle -gt 1 ]; do # --cycle oldcycle=$cycle cycle=$(( $cycle - 1 )) # cycle log if [ -f "$newname.$cycle$DOT_Z" ]; then mv -f -- "$newname.$cycle$DOT_Z" \ "$newname.$oldcycle$DOT_Z" fi if [ -f "$newname.$cycle" ]; then # file was not compressed. move it anyway mv -f -- "$newname.$cycle" "$newname.$oldcycle" fi done # compress the old uncompressed log if needed if [ -f "$newname.0" ]; then if [ -z "$COMPRESS" ]; then newfile="$newname.1" mv -f -- "$newname.0" "$newfile" else newfile="$newname.1$DOT_Z" # $COMPRESS $COMPRESS_OPTS < $newname.0 > $newfile # rm -f $newname.0 $COMPRESS $COMPRESS_OPTS "$newname.0" mv -f -- "$newname.0$DOT_Z" "$newfile" fi fixfile "$newfile" fi # compress the old uncompressed log if needed if test -n "$datum" && test -n "$COMPRESS"; then $COMPRESS $COMPRESS_OPTS -- "$newname".[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] fi # remove old files if so desired if [ -n "$forceclean" ]; then cycle=$(( $count - 1)) if [ -z "$COMPRESS" ]; then list=$(ls -t -- $newname.[0-9]* 2>/dev/null | sed -e 1,${cycle}d) if [ -n "$list" ]; then rm -f -- $list fi else list=$(ls -t -- $newname.[0-9]*$DOT_Z 2>/dev/null | sed -e 1,${cycle}d) if [ -n "$list" ]; then rm -f -- $list fi fi fi # create new file if needed if [ -n "$preserve" ]; then (umask 077 touch -- "$filename.new" chown --reference="$filename" -- "$filename.new" chmod --reference="$filename" -- "$filename.new") filenew=1 elif [ -n "$touch$user$group$mode" ]; then touch -- "$filename.new" fixfile "$filename.new" filenew=1 fi newfilename="$newname.0" # link the file into the file.0 holding place if [ -f "$filename" ]; then if [ -n "$filenew" ]; then if ln -f -- "$filename" "$newfilename"; then mv -f -- "$filename.new" "$filename" else echo "Error hardlinking $filename to $newfilename" >&2 exitcode=8 continue fi else mv -f -- "$filename" "$newfilename" fi fi [ ! -f "$newfilename" ] && touch -- "$newfilename" fixfile "$newfilename" if [ -n "$datum" ]; then mv -- "$newfilename" "$newname.$DATUM" newfilename="$newname.$DATUM" fi if [ -n "$hookscript" ]; then FILE="$newfilename" $SHELL -c "$hookscript" || \ { ret=$? test "$quiet" -eq 1 || echo "Hook script failed with exit code $ret." 1>&2 } fi # report successful rotation test "$quiet" -eq 1 || echo "Rotated \`$filename' at `date`." done exit $exitcode
Upload File
Create Folder