vsftp管理脚本(CentOS6用)
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: vsftpd
# Required-Start: $local_fs $network $named $remote_fs $syslog
# Required-Stop: $local_fs $network $named $remote_fs $syslog
# Short-Description: Very Secure Ftp Daemon
# Description: vsftpd is a Very Secure FTP daemon. It was written completely from
# scratch
### END INIT INFO # vsftpd This shell script takes care of starting and stopping
# standalone vsftpd.
#
# chkconfig: -
# description: Vsftpd is a ftp daemon, which is the program \
# that answers incoming ftp service requests.
# processname: vsftpd
# config: /etc/vsftpd/vsftpd.conf # Source function library.
. /etc/rc.d/init.d/functions # Source networking configuration.
. /etc/sysconfig/network RETVAL=
prog="vsftpd" start() {
# Start daemons. # Check that networking is up.
[ ${NETWORKING} = "no" ] && exit [ -x /usr/sbin/vsftpd ] || exit if [ -d /etc/vsftpd ] ; then
CONFS=`ls /etc/vsftpd/*.conf 2>/dev/null`
[ -z "$CONFS" ] && exit 6
PROC_FAILED=0
for i in $CONFS; do
site=`basename $i .conf`
echo -n $"Starting $prog for $site: "
daemon /usr/sbin/vsftpd $i
RETVAL=$?
echo
if [ $RETVAL -eq 0 ] && [ ! -f /var/lock/subsys/$prog ]; then
touch /var/lock/subsys/$prog
elif [ $RETVAL -ne 0 ]; then
ps -FC vsftpd | grep "$i" > /dev/null
RETVAL=$?
if [ $PROC_FAILED -eq 0 ] && [ $RETVAL -ne 0 ]; then
PROC_FAILED=1
fi
fi
done
if [ $RETVAL -eq 0 ] && [ $PROC_FAILED -ne 0 ]; then
RETVAL=1
fi
else
RETVAL=1
fi
return $RETVAL
} kill_rest_children() {
# all vsftpd processes their parent is init
for chld in `pgrep -P 1 '^vsftpd$'`; do
if [ -n $chld ]; then
puid=`ps -p $chld -o uid= | sed s/^\ *//`
# process UID isn't root - children to kill
if [ "$puid" != "" ]; then
pgrp=`ps -p $chld -o pgrp= | sed s/^\ *//`
if [ "$pgrp" = "$chld" ]; then
# chld is group to kill
kill - -$chld
else
# chld to kill
kill - $chld
fi
fi
fi
done
} stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
kill_rest_children
echo
[ $RETVAL -eq ] && rm -f /var/lock/subsys/$prog
return $RETVAL
} # See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart|try-restart|force-reload)
if [ -f /var/lock/subsys/$prog ]; then
stop
start
RETVAL=$?
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit
esac exit $RETVAL
vsftp管理脚本(CentOS6用)的更多相关文章
- 如何写SysV服务管理脚本
本文目录: 1.1 SysV脚本的特性1.2 SysV脚本要具备的能力1.3 start函数分析1.4 stop函数分析1.5 reload函数分析1.6 status.restart.force-r ...
- [转贴]systemd 编写服务管理脚本
[转贴]sparkdev大神的博客, 关于 systemd的配置文件的 介绍, 自己之前二进制安装 k8s 时 超过一个 service文件 但是当时不明不白的. 现在再学习一下大神的文章 的确牛B ...
- Ubuntu操作系统编写zabbix的启动管理脚本
Ubuntu操作系统编写zabbix的启动管理脚本 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.修改zabbix的pid存放路径 1>.创建存放zabbix的pid目录 ...
- systemd 编写服务管理脚本
我们运行 linux 服务器的主要目的是通过运行程序提供服务,比如 mysql.web server等.因此管理 linux 服务器主要工作就是配置并管理上面运行的各种服务程序.在 linux 系统中 ...
- 大数据项目之_15_帮助文档_NTP 配置时间服务器+Linux 集群服务群起脚本+CentOS6.8 升级到 python 到 2.7
一.NTP 配置时间服务器1.1.检查当前系统时区1.2.同步时间1.3.检查软件包1.4.修改 ntp 配置文件1.5.重启 ntp 服务1.6.设置定时同步任务二.Linux 集群服务群起脚本2. ...
- systemd 编写服务管理脚本---学习
转载:https://www.cnblogs.com/sparkdev/p/8521812.html 我们运行 linux 服务器的主要目的是通过运行程序提供服务,比如 mysql.web serve ...
- Memcache 服务管理脚本
自定义脚本将memcached作为系统服务启动以及开机启动. 一.编写脚本 在/etc/init.d/目录下新建一个脚本,名称为:memcached.内容如下: vi /etc/init.d/memc ...
- linux 程序启动与停止管理脚本
公司接了一个第三方的系统,基于linux写的几个程序,一共有9个部件,第三方没有给脚本,每次启动或停止都得一个一个手工去停止或修改.......,这里稍微鄙视下. 没办法,求人还不如自己动手写, 需求 ...
- 编写shell管理脚本(二)
8.1 先测试“/etc/vsftpd”.“/etc/hosts”是否为目录,并通过“$?”变量查看返回状态值,据此判断测试结果.[root@localhost ~]# [ -d /etc/vsft ...
随机推荐
- Linux下切换使用两个版本的JDK
Linux下切换使用两个版本的JDK 我这里原来已经配置好过一个1.7版本的jdk. 输出命令: java -version [root@hu-hadoop1 sbin]# java -version ...
- Redis在CentOS7中的启动警告
CentOS7安装Redis,启动时会出现如下图3个警告. 问题1:WARNING: The TCP backlog setting of 511 cannot be enforced because ...
- Win10系列:JavaScript动画3
"交叉进出"动画也是Windows动画库中的动画效果."交叉进出"动画的动画效果是在应用程序界面上隐藏一个元素并同时在相同位置显示另一个元素的时候,被隐藏的元素 ...
- learning scala ide tools install
reference : https://www.jetbrains.com/help/idea/install-and-set-up-product.html env in ubuntu 16.04 ...
- lubuntu16.04 安装过程以及ssd测试模型的环境配置
1.系统启动盘(ultraISO)制作启动盘, 1/5 文件->打开,打开我们的iso镜像 2/5 选择我们的u盘, 3/5 点击启动->写入硬盘映像 4/5 写入方式选择raw,格式化然 ...
- shlve 模块
shlve 模块 也用于序列化 它与pickle 不同之处在于 不需要惯性文件模式什么的 直接把它当成一个字典来看待 它可以直接对数据进行修改 而不用覆盖原来的数据 而pickle 你想要修改只能 ...
- 使用DDMS查看设备内的文件系统
system文件系统存储了一些系统相关的文件 system/app里面是系统自带的应用程序 system/fonts里面存放的是系统自带的字体 system/frameworks里面存放的是系统的一些 ...
- Linux防火墙iptables的策略
iptables策略 iptables -L #查看现有防火墙所有策略 iptables -F #清除现有防火墙策略 只允许特定流量通过,禁用其他流量 1.允许SSH流量(重要) iptables - ...
- Python Django 之 Template 模板的使用
一.模板样式 注意: 1.url urlpatterns = { path('admin/', admin.site.urls), path('order/', views.order), path( ...
- 【转】caffe数据层及参数
原文: 要运行caffe,需要先创建一个模型(model),如比较常用的Lenet,Alex等, 而一个模型由多个层(layer)构成,每一层又由许多参数组成.所有的参数都定义在caffe.proto ...