Linux Comm Ftpshut
# Linux ftpshut Command
[ Linux Command Manual](#)
The Linux `ftpshut` command shuts down the FTP server at a specified time.
`ftpshut` allows a system administrator to shut down the FTP service at a specified time and send a warning message to connected FTP users before shutdown.
This command is typically used for system maintenance, upgrades, or other scenarios where temporarily stopping the FTP service is required.
`ftpshut` If the shutdown time is set to "none", the server will shut down immediately. If set using the "+30" format, it means the server will shut down in 30 minutes. If using the "1130" format, it means the server will shut down at 11:30 daily, using a 24-hour time format.
After the FTP server is shut down, a file named `shutmsg` will be created in the `/etc` directory. Deleting this file will allow the FTP server to start again.
### Syntax
`ftpshut `
**Parameters**:
* **time**: Specifies the time to shut down the FTP service. The time can be expressed in the format `+minutes` (e.g., `+10` means shut down in 10 minutes) or in `HHMM` format (e.g., `1430` means shut down at 2:30 PM).
* **warning message**: The warning message sent to all connected FTP users before the FTP service shuts down. The message content can include the following placeholders:
* `%s`: Represents the time the FTP service will shut down.
* `%r`: Represents the time the FTP service will restart after shutdown.
* `%d`: Represents the remaining time until the FTP service shuts down (in minutes).
**Common Options:**
* `-l `: Specifies the time (in minutes) before FTP service shutdown to refuse new user logins.
* `-d `: Specifies the time (in minutes) before FTP service shutdown to disconnect all user connections.
### Examples
To shut down the FTP server at 11:00 PM, refuse new FTP logins 5 minutes before shutdown, close all FTP connections 3 minutes before shutdown, and provide a warning message, use the following command:
`ftpshut -d 3 -l 5 1100 "Server will be shutdown at 23:00:00"`
Suppose you want to shut down the FTP service in 10 minutes and send a warning message to users, you can use the following command:
`ftpshut +10 "FTP service will shut down at %s, please complete your operations as soon as possible."`
In this example, `+10` means the FTP service will shut down in 10 minutes, `"FTP service will shut down at %s, please complete your operations as soon as possible."` is the warning message sent to users, and `%s` will be replaced with the actual shutdown time.
If you want to shut down the FTP service at 3:00 PM, you can use the following command:
`ftpshut 1500 "FTP service will shut down at %s, expected to restart at %r."`
In this example, `1500` means the FTP service will shut down at 3:00 PM, `"FTP service will shut down at %s, expected to restart at %r."` is the warning message sent to users, and `%s` and `%r` will be replaced with the actual shutdown and restart times.
If you want to refuse new user logins 5 minutes before shutting down the FTP service, you can use the following command:
`ftpshut -l 5 +10 "FTP service will shut down at %s, please complete your operations as soon as possible."`
In this example, `-l 5` means refusing new user logins 5 minutes before shutdown, and `+10` means the FTP service will shut down in 10 minutes.
If you want to disconnect all user connections 2 minutes before shutting down the FTP service, you can use the following command:
`ftpshut -d 2 +10 "FTP service will shut down at %s, please complete your operations as soon as possible."`
In this example, `-d 2` means disconnecting all user connections 2 minutes before shutdown, and `+10` means the FTP service will shut down in 10 minutes.
* * *
## Notes
* The `ftpshut` command is often used in conjunction with the `ftpwho` command, which can view currently connected FTP users.
* After using `ftpshut` to shut down the FTP service, if you need to restart the FTP service, you can use the `service vsftpd restart` or `systemctl restart vsftpd` command (the specific command depends on your FTP server software and system configuration).
* The `ftpshut` command is typically used with FTP server software like `vsftpd` or `proftpd`, and specific support may vary depending on the FTP server software.
[ Linux Command Manual](#)
YouTip