Linux ftpshut Command
The Linux ftpshut command shuts down the FTP server at a specified time.
ftpshut It allows system administrators to shut down the FTP service at a specified time and send warning messages to connected FTP users before shutting down.
This command is typically used for system maintenance, upgrades, or other scenarios that require temporarily stopping the FTP service.
code>ftpshut If the shutdown time is set to "none", the server shuts down immediately. Using the "+30" format means the server shuts down in 30 minutes. Using the "1130" format means the server shuts down daily at 11:30, in 24-hour format.
After the FTP server is shut down, a file named shutmsg is created in the /etc directory; deleting it re-enables the FTP server.
Syntax
ftpshut [选项] [时间] [警告消息]
Parameters:
-
Time: specify the time to shut down the FTP service. The time can be given in the form of
+分钟(for example,+10meaning shut down in 10 minutes), or asHHMM(for example,1430meaning shut down at 2:30 PM). -
Warning message: a warning message sent to all connected FTP users before the service shuts down. The message can contain the following placeholders:
%s: indicates the time when the FTP service shuts down.%r: indicates the time when the FTP service restarts after shutdown.%d: indicates the remaining time before the FTP service shuts down (in minutes).
** Common options:**
-l <分钟>: specify the time (in minutes) before shutdown during which new user logins are rejected.-d <分钟>: specify the time (in minutes) before shutdown at which all user connections are disconnected.
Example
To shut down the FTP server at 11:00 PM, reject new FTP logins 5 minutes before, disconnect all ftp connections 3 minutes before, and issue a warning message, use the following command:
ftpshut-d 3 -1 5 1100 "Server will be shutdown at 23:00:00"
If you want to shut down the FTP service in 10 minutes and send users a warning message, use the following command:
ftpshut +10 "FTP 服务将在 %s 关闭,请尽快完成操作。"
In this example,+10 means shut down the FTP service in 10 minutes,"FTP 服务将在 %s 关闭,请尽快完成操作。" is the warning message sent to users,%s is replaced by the actual shutdown time.
If you want to shut down the FTP service at 3:00 PM, use the following command:
ftpshut 1500 "FTP 服务将在 %s 关闭,预计在 %r 重新启动。"
In this example,1500 means shut down the FTP service at 3:00 PM,"FTP 服务将在 %s 关闭,预计在 %r 重新启动。" is the warning message sent to users,%s and %r is replaced by the actual shutdown and restart times.
If you want to reject new user logins 5 minutes before shutting down the FTP service, use the following command:
ftpshut -l 5 +10 "FTP 服务将在 %s 关闭,请尽快完成操作。"
In this example,-l 5 means reject new user logins 5 minutes before shutdown,+10 means shut down the FTP service in 10 minutes.
If you want to disconnect all users 2 minutes before shutting down the FTP service, use the following command:
ftpshut -d 2 +10 "FTP 服务将在 %s 关闭,请尽快完成操作。"
In this example,-d 2 means disconnect all users 2 minutes before shutdown,+10 means shut down the FTP service in 10 minutes.
Notes
ftpshutThe command is usually used together with theftpwhocommand,ftpwhowhich can display the currently connected FTP users.- Use
ftpshutAfter shutting down the FTP service, to restart it you can use theservice vsftpd restartorsystemctl restart vsftpdcommand (the exact command depends on your FTP server software and system configuration). ftpshutThe command is typically used withvsftpdorproftpdand other FTP server software; specific support may vary depending on the server software.
Linux Command Reference