01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#! /bin/bash shopt -s -o nounset
declare -i p=0
SRC=${1:? 'Please input src files name' }
DEST=${2:? 'Plesae input dest files name' }
Total=$(stat -c %s $SRC) touch $DEST
( cp -f $SRC $DEST; sync ) &
{ while ((p < 100))
do Size=$(stat -c %s $DEST)
p=Size*100 /Total
echo $p
sleep 1
done } | dialog --guage "复制进度" 10 50 0
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/bash host= "192.168.99.99 21"
id = "user"
pw= 'mima'
basedir= "/var/lib/db"
filename= "mybackup.`date +%Y%m%d%H%M`.gz"
cd $basedir
/usr/local/mysql/bin/mysqldump --opt -hlocalhost -uroot -ppswd data | gzip -f>/ "$basedir" / "$filename"
ftp -n $host> /dev/null 2> /dev/null < <EOF
user $ id $pw
binary put $filename bye EOF cd $basedir
rm -rf $filename
#!/bin/bash myday=` date +%F`
mytime=` date +%T -- date = "-1 hour" `
##PURGE BINARY LOGS BEFORE '2000-02-02 22:22:22'; #echo $myday $mytime mysql -uroot -p123456 << EOF PURGE BINARY LOGS BEFORE '${myday} ${mytime}' ;
#EOF #!/bin/bash #Disable sshd dns sed -i 's/#UseDNS.*/UseDNS no/g' /etc/ssh/sshd_config
sed -i 's/^GSSAPIAuthentication.*/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
sed -i 's/^#GSSAPIAuthentication.*/GSSAPIAuthentication no/' /etc/ssh/sshd_config
#Sudo log groupadd admin echo "%admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "Defaults logfile = \"/var/log/sudo\"" >> /etc/sudoers
echo "local2.debug /var/log/sudo" >> /etc/syslog .conf
#Turn off snmpd log echo "OPTIONS=\"-LS3d -Lf /dev/null -p /var/run/snmpd.pid\"" >> /etc/sysconfig/snmpd .options
#Record sftp log sed -i '/Subsystem/d' /etc/ssh/sshd_config
echo "Subsystem sftp /usr/libexec/openssh/sftp-server -l INFO -f AUTH" >> /etc/ssh/sshd_config
echo "auth,authpriv.* /var/log/sftp" >> /etc/syslog .conf
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/bin/bash yum install -y vsftpd yum install -y db4* rm -rf /etc/vsftpd/vsftpd.conf cat < < 'EOF' >> /etc/vsftpd/vsftpd.conf listen_port=21 anonymous_enable=NO local_enable=YES write_enable=NO anon_upload_enable=NO anon_mkdir_write_enable=NO anon_other_write_enable=NO chroot_local_user=YES guest_enable=YES guest_username=nobody user_config_dir=/etc/vsftpd/nobody/ ftpd_banner=welcome vsftp! pam_service_name=vsftpd.vu #tcp_wrappers=YES vsftpd_log_file=/var/log/vsftpd.log listen=YES dual_log_enable=YES xferlog_enable=YES EOF cat < < 'EOF' >> /etc/pam.d/vsftpd.vu auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login account required /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login EOF mkdir /etc/vsftpd/nobody cat < < 'EOF' >> /etc/vsftpd/nobody/ftpadmin anon_world_readable_only=NO write_enable=YES anon_mkdir_write_enable=YES anon_upload_enable=YES anon_other_write_enable=YES anon_umask=022 file_open_mode=0777 local_root=/tmp EOF cat < < 'EOF' >> /etc/vsftpd/nobody/upload anon_world_readable_only=NO write_enable=YES anon_mkdir_write_enable=YES anon_upload_enable=YES local_root=/tmp/up EOF cat < < 'EOF' >> /etc/vsftpd/nobody/download anon_world_readable_only=NO local_root=/tmp/down EOF echo "ftpadmin" > /etc/vsftpd/logins.txt echo "ftpadmin" >> /etc/vsftpd/logins.txt echo "upload" >> /etc/vsftpd/logins.txt echo "upload" >> /etc/vsftpd/logins.txt echo "download" >> /etc/vsftpd/logins.txt echo "download" >> /etc/vsftpd/logins.txt echo "db_load -T -t hash -f /etc/vsftpd/logins.txt /etc/vsftpd/vsftpd_login.db" >/etc/vsftpd/cmd chmod u+x /etc/vsftpd/cmd sh /etc/vsftpd/cmd chkconfig --level 3 vsftpd on service vsftpd start |
1
2
3
4
5
|
if [ "`whoami`" != "root" ] ;then print "This must be run as root."
exit -1
fi |
1
2
3
4
5
|
01
02
03
04
05
06
07
08
09
10
11
|
if [ ! -d /usr/local/jpeg ] then
tar zxvf jpegsrc.v7.tar.gz
cd jpeg-7
./configure --prefix=/usr/local/jpeg
make
make install
cd ..
rm -rf jpeg-7
echo "gpeg install is ok!"
fi
|
1
2
3
|
if [ -e "./soft.tar.gz" ] && [ ! -d "./soft" ]; then tar -zxvf soft.tar.gz
fi |
相关推荐
unix shell scripts used to collect OS and network metrics
学习unix shell编程不错的材料。
linux shell scripts linux shell scripts linux shell scripts
ShellScripts2009 ShellScripts2009 ShellScripts2009 ShellScripts2009 ShellScripts2009
common shell scripts
第十三章、学习 Shell Scripts最近更新日期:2009/02/18如果你真的很想要走信息这条路,并且想要好好的管理好属于你的主机,那么,别说鸟哥不告诉
Wicked Cool Shell Scripts: 101 Scripts for Linux, Mac OS X, and Unix Systems <br>This cookbook of useful, customizable, and fun scripts gives you the tools to solve common Linux, Mac OS X and UNIX ...
本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者
Writing C-shell scripts (Guide3, Version3.0) The c-shell is the program which interprets the commands that you type at the keyboard when you use the Unix operting system. It is possible to put C-shell...
Sample Shell Scripts
cdr-rep cdr-rep cdr-rep cdr-rep cdr-rep cdr-rep
one good PPT on shell basic scripting
脚本 Chisimba 框架的 Shellscripts。
This book is aimed at administrators and those who have a basic knowledge of shell scripting and who want to learn how to get the most out of writing shell scripts. What You Will Learn Write ...
Break through the practice of writing tedious code with shell scripts Key Features Learn to impeccably build shell scripts and develop advanced applications Create smart solutions by writing and ...
shellscripts:ITN170
Writing shell scripts requires more than just a knowledge of the shell language. It also requires familiarity with the individual Unix programs: you need to know why each program is there and how to ...
sample_shellscripts
Shell Scripts是个自动管理系统软件的好工具,它可以简化我们日常工作管理,入侵检测呀,数据处理呀,而且很多服务都可以利用到它。它跨平台支持且学习历程短(不像程序语言那么难学哦)。 Contend 一、简单入门...
ShellScripts 自定义 Shell 脚本 我的杂项 shell 脚本目录。 一些powershell,一些bash。