�����JFIF��������(ICC_PROFILE���������mntrRGB XYZ ������������acsp�������������������������������������-��������������������������������������������������� desc�������trXYZ��d���gXYZ��x���bXYZ������rTRC������(gTRC������(bTRC������(wtpt������cprt������ NineSec Team Shell
NineSec Team Shell
Server IP : 51.38.211.120  /  Your IP : 216.73.216.188
Web Server : Apache
System : Linux bob 5.15.85-1-pve #1 SMP PVE 5.15.85-1 (2023-02-01T00:00Z) x86_64
User : readytorun ( 1067)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF
Directory (0755) :  /sbin/

[  Home  ][  C0mmand  ][  Upload File  ][  Lock Shell  ][  Logout  ]

Current File : //sbin/e2scrub_all
#!/bin/bash

#  Copyright (C) 2018 Oracle.  All Rights Reserved.
#
#  Author: Darrick J. Wong <darrick.wong@oracle.com>
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it would be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write the Free Software Foundation,
#  Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

if (( $EUID != 0 )); then
    echo "e2scrub_all must be run as root"
    exit 1
fi

periodic_e2scrub=0
scrub_all=0
snap_size_mb=256
reap=0
conffile="/etc/e2scrub.conf"

test -f "${conffile}" && . "${conffile}"

scrub_args=""

print_help() {
	echo "Usage: $0 [OPTIONS]"
	echo " -n: Show what commands e2scrub_all would execute."
	echo " -r: Remove e2scrub snapshots."
	echo " -A: Scrub all ext[234] filesystems even if not mounted."
	echo " -V: Print version information and exit."
}

print_version() {
	echo "e2scrub_all 1.45.5 (07-Jan-2020)"
}

exitcode() {
	ret="$1"

	# If we're being run as a service, the return code must fit the LSB
	# init script action error guidelines, which is to say that we
	# compress all errors to 1 ("generic or unspecified error", LSB 5.0
	# section 22.2) and hope the admin will scan the log for what
	# actually happened.

	if [ -n "${SERVICE_MODE}" -a "${ret}" -ne 0 ]; then
		test "${ret}" -ne 0 && ret=1
	fi

	exit "${ret}"
}

while getopts "nrAV" opt; do
	case "${opt}" in
	"n") DBG="echo Would execute: " ;;
	"r") scrub_args="${scrub_args} -r"; reap=1;;
	"A") scrub_all=1;;
	"V") print_version; exitcode 0;;
	*) print_help; exitcode 2;;
	esac
done
shift "$((OPTIND - 1))"

# If we're in service mode and the service is not enabled via config file...
if [ -n "${SERVICE_MODE}" -a "${periodic_e2scrub}" -ne 1 ]; then
	# ...don't start e2scrub processes.
	if [ "${reap}" -eq 0 ]; then
		exitcode 0
	fi

	# ...and if we don't see any leftover e2scrub snapshots, don't
	# run the reaping process either, because lvs can be slow.
	if ! readlink -q -s -e /dev/mapper/*.e2scrub* > /dev/null; then
		exitcode 0
	fi
fi

# close file descriptor 3 (from cron) since it causes lvm to kvetch
exec 3<&-

# If some prerequisite packages are not installed, exit with a code
# indicating success to avoid spamming the sysadmin with fail messages
# when e2scrub_all is run out of cron or a systemd timer.

if ! type mapfile >& /dev/null ; then
    test -n "${SERVICE_MODE}" && exitcode 0
    echo "e2scrub_all: can't find mapfile --- is bash 4.xx installed?"
    exitcode 1
fi

if ! type lsblk >& /dev/null ; then
    test -n "${SERVICE_MODE}" && exitcode 0
    echo "e2scrub_all: can't find lsblk --- is util-linux installed?"
    exitcode 1
fi

if ! type lvcreate >& /dev/null ; then
    test -n "${SERVICE_MODE}" && exitcode 0
    echo "e2scrub_all: can't find lvcreate --- is lvm2 installed?"
    exitcode 1
fi

# Find scrub targets, make sure we only do this once.
ls_scan_targets() {
    local devices=$(lvs -o lv_path --noheadings -S "lv_active=active,lv_role=public,lv_role!=snapshot,vg_free>=${snap_size_mb}")

    if [ -z "$devices" ]; then
	return 0;
    fi
    lsblk -o NAME,MOUNTPOINT,FSTYPE,TYPE -P -n -p $devices | \
	grep FSTYPE=\"ext\[234\]\" | grep TYPE=\"lvm\" | \
	while read vars ; do
		eval "${vars}"

		if [ "${scrub_all}" -eq 1 ] || [ -n "${MOUNTPOINT}" ]; then
		    echo ${MOUNTPOINT:-${NAME}}
		fi
	done
}

# Find leftover scrub snapshots
ls_reap_targets() {
    lvs -o lv_path -S lv_role=snapshot -S lv_name=~\(e2scrub$\) \
	--noheadings | sed -e 's/.e2scrub$//'
}

# Figure out what we're targeting
ls_targets() {
	if [ "${reap}" -eq 1 ]; then
		ls_reap_targets
	else
		ls_scan_targets
	fi
}

# systemd doesn't know to do path escaping on the instance variable we pass
# to the e2scrub service, which breaks things if there is a dash in the path
# name.  Therefore, do the path escaping ourselves if needed.
#
# systemd path escaping also drops the initial slash so we add that back in so
# that log messages from the service units preserve the full path and users can
# look up log messages using full paths.  However, for "/" the escaping rules
# do /not/ drop the initial slash, so we have to special-case that here.
escape_path_for_systemd() {
	local path="$1"

	if [ "${path}" != "/" ]; then
		echo "-$(systemd-escape --path "${path}")"
	else
		echo "-"
	fi
}

# Scrub any mounted fs on lvm by creating a snapshot and fscking that.
mapfile -t targets < <(ls_targets)
for tgt in "${targets[@]}"; do
	# If we're not reaping and systemd is present, try invoking the
	# systemd service.
	if [ "${reap}" -ne 1 ] && type systemctl > /dev/null 2>&1; then
		tgt_esc="$(escape_path_for_systemd "${tgt}")"
		${DBG} systemctl start "e2scrub@${tgt_esc}" 2> /dev/null
		res=$?
		if [ "${res}" -eq 0 ] || [ "${res}" -eq 1 ]; then
			continue;
		fi
	fi

	# Otherwise use direct invocation
	${DBG} "/sbin/e2scrub" ${scrub_args} "${tgt}"
done

exitcode 0

NineSec Team - 2022
Name
Size
Last Modified
Owner
Permissions
Options
..
--
May 29 2025 6:02:43
root
0755
agetty
67.383 KB
May 30 2023 5:42:35
root
0755
badblocks
34.32 KB
June 02 2022 2:59:32
root
0755
blkdeactivate
14.489 KB
February 13 2020 10:21:51
root
0755
blkdiscard
34.227 KB
May 30 2023 5:42:35
root
0755
blkid
118.258 KB
May 30 2023 5:42:35
root
0755
blkzone
70.227 KB
May 30 2023 5:42:35
root
0755
blockdev
66.227 KB
May 30 2023 5:42:35
root
0755
bridge
102.305 KB
February 13 2020 6:21:59
root
0755
capsh
30.305 KB
June 07 2023 3:02:37
root
0755
cfdisk
102.586 KB
May 30 2023 5:42:35
root
0755
chcpu
46.227 KB
May 30 2023 5:42:35
root
0755
ctrlaltdel
38.227 KB
May 30 2023 5:42:35
root
0755
debugfs
225.805 KB
June 02 2022 2:59:32
root
0755
depmod
170.336 KB
January 28 2022 3:49:50
root
0755
devlink
150.469 KB
February 13 2020 6:21:59
root
0755
dhclient
508.984 KB
January 31 2023 11:10:35
root
0755
dhclient-script
15.922 KB
January 31 2023 11:10:35
root
0755
dmeventd
50.234 KB
February 13 2020 10:21:51
root
0755
dmsetup
171.023 KB
February 13 2020 10:21:51
root
0755
dmstats
171.023 KB
February 13 2020 10:21:51
root
0755
dosfsck
58.078 KB
May 13 2018 12:59:39
root
0755
dosfslabel
54.078 KB
May 13 2018 12:59:39
root
0755
dumpe2fs
30.383 KB
June 02 2022 2:59:32
root
0755
e2fsck
327.211 KB
June 02 2022 2:59:32
root
0755
e2image
42.383 KB
June 02 2022 2:59:32
root
0755
e2label
106.555 KB
June 02 2022 2:59:32
root
0755
e2mmpstatus
30.383 KB
June 02 2022 2:59:32
root
0755
e2scrub
7.125 KB
June 02 2022 2:59:32
root
0755
e2scrub_all
5.269 KB
June 02 2022 2:59:32
root
0755
e2undo
22.375 KB
June 02 2022 2:59:32
root
0755
fatlabel
54.078 KB
May 13 2018 12:59:39
root
0755
fdisk
150.273 KB
May 30 2023 5:42:35
root
0755
findfs
14.227 KB
May 30 2023 5:42:35
root
0755
fsadm
23.543 KB
February 13 2020 10:21:51
root
0755
fsck
54.273 KB
May 30 2023 5:42:35
root
0755
fsck.cramfs
38.258 KB
May 30 2023 5:42:35
root
0755
fsck.ext2
327.211 KB
June 02 2022 2:59:32
root
0755
fsck.ext3
327.211 KB
June 02 2022 2:59:32
root
0755
fsck.ext4
327.211 KB
June 02 2022 2:59:32
root
0755
fsck.fat
58.078 KB
May 13 2018 12:59:39
root
0755
fsck.minix
122.25 KB
May 30 2023 5:42:35
root
0755
fsck.msdos
58.078 KB
May 13 2018 12:59:39
root
0755
fsck.vfat
58.078 KB
May 13 2018 12:59:39
root
0755
fsfreeze
14.227 KB
May 30 2023 5:42:35
root
0755
fstab-decode
14.305 KB
February 13 2020 7:38:21
root
0755
fstrim
70.227 KB
May 30 2023 5:42:35
root
0755
getcap
14.305 KB
June 07 2023 3:02:37
root
0755
getpcaps
14.305 KB
June 07 2023 3:02:37
root
0755
getty
67.383 KB
May 30 2023 5:42:35
root
0755
halt
973.227 KB
November 21 2023 10:10:21
root
0755
hdparm
140.336 KB
August 21 2019 2:36:14
root
0755
hwclock
102.352 KB
May 30 2023 5:42:35
root
0755
ifconfig
85.109 KB
February 01 2019 7:07:53
root
0755
init
1.55 MB
November 21 2023 10:10:21
root
0755
insmod
170.336 KB
January 28 2022 3:49:50
root
0755
installkernel
2.576 KB
December 07 2019 3:13:44
root
0755
ip
597.617 KB
February 13 2020 6:21:59
root
0755
ipmaddr
17.992 KB
February 01 2019 7:07:53
root
0755
ipset
14.148 KB
November 25 2021 10:55:19
root
0755
iptunnel
25.992 KB
February 01 2019 7:07:53
root
0755
isosize
30.227 KB
May 30 2023 5:42:35
root
0755
kbdrate
13.992 KB
May 09 2019 5:22:51
root
0755
killall5
26.383 KB
February 13 2020 7:38:21
root
0755
ldconfig
0.378 KB
November 22 2023 2:32:50
root
0755
ldconfig.real
1 MB
November 22 2023 2:32:50
root
0755
logsave
14.156 KB
June 02 2022 2:59:32
root
0755
losetup
110.344 KB
May 30 2023 5:42:35
root
0755
lsmod
170.336 KB
January 28 2022 3:49:50
root
0755
lvchange
2.73 MB
February 13 2020 10:21:51
root
0755
lvconvert
2.73 MB
February 13 2020 10:21:51
root
0755
lvcreate
2.73 MB
February 13 2020 10:21:51
root
0755
lvdisplay
2.73 MB
February 13 2020 10:21:51
root
0755
lvextend
2.73 MB
February 13 2020 10:21:51
root
0755
lvm
2.73 MB
February 13 2020 10:21:51
root
0755
lvmconfig
2.73 MB
February 13 2020 10:21:51
root
0755
lvmdiskscan
2.73 MB
February 13 2020 10:21:51
root
0755
lvmdump
10.07 KB
February 13 2020 10:21:51
root
0755
lvmpolld
232.055 KB
February 13 2020 10:21:51
root
0755
lvmsadc
2.73 MB
February 13 2020 10:21:51
root
0755
lvmsar
2.73 MB
February 13 2020 10:21:51
root
0755
lvreduce
2.73 MB
February 13 2020 10:21:51
root
0755
lvremove
2.73 MB
February 13 2020 10:21:51
root
0755
lvrename
2.73 MB
February 13 2020 10:21:51
root
0755
lvresize
2.73 MB
February 13 2020 10:21:51
root
0755
lvs
2.73 MB
February 13 2020 10:21:51
root
0755
lvscan
2.73 MB
February 13 2020 10:21:51
root
0755
mii-tool
26.461 KB
February 01 2019 7:07:53
root
0755
mkdosfs
34.5 KB
May 13 2018 12:59:39
root
0755
mke2fs
134.617 KB
June 02 2022 2:59:32
root
0755
mkfs
14.227 KB
May 30 2023 5:42:35
root
0755
mkfs.bfs
34.227 KB
May 30 2023 5:42:35
root
0755
mkfs.cramfs
42.156 KB
May 30 2023 5:42:35
root
0755
mkfs.ext2
134.617 KB
June 02 2022 2:59:32
root
0755
mkfs.ext3
134.617 KB
June 02 2022 2:59:32
root
0755
mkfs.ext4
134.617 KB
June 02 2022 2:59:32
root
0755
mkfs.fat
34.5 KB
May 13 2018 12:59:39
root
0755
mkfs.minix
106.234 KB
May 30 2023 5:42:35
root
0755
mkfs.msdos
34.5 KB
May 13 2018 12:59:39
root
0755
mkfs.ntfs
86.266 KB
November 01 2022 12:56:50
root
0755
mkfs.vfat
34.5 KB
May 13 2018 12:59:39
root
0755
mkhomedir_helper
22.172 KB
January 10 2024 2:55:08
root
0755
mkntfs
86.266 KB
November 01 2022 12:56:50
root
0755
mkswap
106.234 KB
May 30 2023 5:42:35
root
0755
modinfo
170.336 KB
January 28 2022 3:49:50
root
0755
modprobe
170.336 KB
January 28 2022 3:49:50
root
0755
mount.fuse
14.148 KB
March 07 2020 12:09:49
root
0755
mount.lowntfs-3g
118.859 KB
November 01 2022 12:56:50
root
0755
mount.ntfs
158.891 KB
November 01 2022 12:56:50
root
0755
mount.ntfs-3g
158.891 KB
November 01 2022 12:56:50
root
0755
nameif
18.141 KB
February 01 2019 7:07:53
root
0755
ntfsclone
58.273 KB
November 01 2022 12:56:50
root
0755
ntfscp
42.258 KB
November 01 2022 12:56:50
root
0755
ntfslabel
34.258 KB
November 01 2022 12:56:50
root
0755
ntfsresize
78.273 KB
November 01 2022 12:56:50
root
0755
ntfsundelete
54.258 KB
November 01 2022 12:56:50
root
0755
on_ac_power
2.176 KB
July 20 2019 5:43:51
root
0755
pam_extrausers_chkpwd
42.156 KB
January 10 2024 2:55:08
root
2755
pam_extrausers_update
42.156 KB
January 10 2024 2:55:08
root
0755
pam_tally
14.164 KB
January 10 2024 2:55:08
root
0755
pam_tally2
18.164 KB
January 10 2024 2:55:08
root
0755
parted
86.25 KB
December 01 2020 4:18:05
root
0755
partprobe
14.227 KB
December 01 2020 4:18:05
root
0755
pivot_root
14.227 KB
May 30 2023 5:42:35
root
0755
plipconfig
14 KB
February 01 2019 7:07:53
root
0755
plymouthd
146.406 KB
November 02 2020 11:02:17
root
0755
poweroff
973.227 KB
November 21 2023 10:10:21
root
0755
pvchange
2.73 MB
February 13 2020 10:21:51
root
0755
pvck
2.73 MB
February 13 2020 10:21:51
root
0755
pvcreate
2.73 MB
February 13 2020 10:21:51
root
0755
pvdisplay
2.73 MB
February 13 2020 10:21:51
root
0755
pvmove
2.73 MB
February 13 2020 10:21:51
root
0755
pvremove
2.73 MB
February 13 2020 10:21:51
root
0755
pvresize
2.73 MB
February 13 2020 10:21:51
root
0755
pvs
2.73 MB
February 13 2020 10:21:51
root
0755
pvscan
2.73 MB
February 13 2020 10:21:51
root
0755
quotacheck
111.375 KB
April 09 2019 10:12:04
root
0755
quotaoff
83.125 KB
April 09 2019 10:12:04
root
0755
quotaon
83.125 KB
April 09 2019 10:12:04
root
0755
rarp
40.453 KB
February 01 2019 7:07:53
root
0755
raw
14.227 KB
May 30 2023 5:42:35
root
0755
reboot
973.227 KB
November 21 2023 10:10:21
root
0755
resize2fs
66.375 KB
June 02 2022 2:59:32
root
0755
rmmod
170.336 KB
January 28 2022 3:49:50
root
0755
route
64.305 KB
February 01 2019 7:07:53
root
0755
rtacct
48.289 KB
February 13 2020 6:21:59
root
0755
rtmon
78.242 KB
February 13 2020 6:21:59
root
0755
runlevel
973.227 KB
November 21 2023 10:10:21
root
0755
runuser
66.227 KB
May 30 2023 5:42:35
root
0755
setcap
14.305 KB
June 07 2023 3:02:37
root
0755
setvtrgb
14.133 KB
May 09 2019 5:22:51
root
0755
sfdisk
138.227 KB
May 30 2023 5:42:35
root
0755
shadowconfig
0.864 KB
July 15 2021 12:08:18
root
0755
shutdown
973.227 KB
November 21 2023 10:10:21
root
0755
slattach
44.453 KB
February 01 2019 7:07:53
root
0755
start-stop-daemon
47.32 KB
May 25 2022 1:14:20
root
0755
sulogin
50.227 KB
May 30 2023 5:42:35
root
0755
swaplabel
18.227 KB
May 30 2023 5:42:35
root
0755
swapoff
22.227 KB
May 30 2023 5:42:35
root
0755
swapon
50.227 KB
May 30 2023 5:42:35
root
0755
switch_root
14.227 KB
May 30 2023 5:42:35
root
0755
sysctl
30.234 KB
October 31 2023 12:35:56
root
0755
tc
529.453 KB
February 13 2020 6:21:59
root
0755
telinit
973.227 KB
November 21 2023 10:10:21
root
0755
tipc
126.234 KB
February 13 2020 6:21:59
root
0755
tune2fs
106.555 KB
June 02 2022 2:59:32
root
0755
unix_chkpwd
42.148 KB
January 10 2024 2:55:08
root
2755
unix_update
42.148 KB
January 10 2024 2:55:08
root
0755
vgcfgbackup
2.73 MB
February 13 2020 10:21:51
root
0755
vgcfgrestore
2.73 MB
February 13 2020 10:21:51
root
0755
vgchange
2.73 MB
February 13 2020 10:21:51
root
0755
vgck
2.73 MB
February 13 2020 10:21:51
root
0755
vgconvert
2.73 MB
February 13 2020 10:21:51
root
0755
vgcreate
2.73 MB
February 13 2020 10:21:51
root
0755
vgdisplay
2.73 MB
February 13 2020 10:21:51
root
0755
vgexport
2.73 MB
February 13 2020 10:21:51
root
0755
vgextend
2.73 MB
February 13 2020 10:21:51
root
0755
vgimport
2.73 MB
February 13 2020 10:21:51
root
0755
vgimportclone
2.73 MB
February 13 2020 10:21:51
root
0755
vgmerge
2.73 MB
February 13 2020 10:21:51
root
0755
vgmknodes
2.73 MB
February 13 2020 10:21:51
root
0755
vgreduce
2.73 MB
February 13 2020 10:21:51
root
0755
vgremove
2.73 MB
February 13 2020 10:21:51
root
0755
vgrename
2.73 MB
February 13 2020 10:21:51
root
0755
vgs
2.73 MB
February 13 2020 10:21:51
root
0755
vgscan
2.73 MB
February 13 2020 10:21:51
root
0755
vgsplit
2.73 MB
February 13 2020 10:21:51
root
0755
wipefs
46.227 KB
May 30 2023 5:42:35
root
0755
zramctl
114.344 KB
May 30 2023 5:42:35
root
0755

NineSec Team - 2022