This plugin executes run configurations automatically when closing a project or IDE - the mirror feature of IntelliJ's built-in "Startup Tasks".
- Shutdown Tasks Plugin for JetBrains IDE family
- Run any configured run/debug configuration when closing your project
- Tasks are executed in the order you define
- IDE waits for each task to complete
- Configurable timeout per task (1-300 seconds)
- Visual progress dialog with real-time status
- Task output may be visible in Run tool window
- Cancel anytime during execution
- Intuitive configuration panel in Settings → Tools → Shutdown Tasks
- Visual task list with configuration icons
- Add/Edit/Remove and Reorder tasks easily
- Open Settings/Preferences → Plugins
- Search for "Shutdown Tasks"
- Click Install
- Restart IDE
- Download the latest release from Releases
- Open Settings/Preferences → Plugins
- Click ⚙️ → Install Plugin from Disk...
- Select the downloaded
.zipfile - Restart IDE
git clone https://github.com/gdw96/shutdown-tasks.git
cd shutdown-tasks
./gradlew buildPlugin-
Open Settings
File → Settings(Windows/Linux)IntelliJ IDEA → Preferences(macOS)- Or press
Ctrl+Alt+S/⌘+,
-
Navigate to Shutdown Tasks
Tools → Shutdown Tasks
-
Add Tasks
- Click the + button
- Select a run configuration
- Click OK
-
Remove Tasks
- Select a run configuration
- Click the - button
-
Edit Tasks
- Select a run configuration
- Click the 🖊 button
-
Reorder Tasks (Optional)
- Select a run configuration
- Use ▲ / ▼ buttons to change execution order
-
Set Timeout
- Default: 5 seconds per task
- Range: 1-300 seconds
⚠️ Important: The IDE will wait for the total duration of the timeout for each task where it is impossible to monitor execution.
-
Apply Changes
- Click Apply or OK
#!/bin/bash
echo "Stopping development server..."
# Your server stop command here
echo "Server stopped"
exitConfiguration:
- Type: Shell Script
- Script:
stop-server.sh - Interpreter path:
/bin/bash - Execute in the terminal: Unchecked
⚠️ Important⚠️
- Cleanup temporary files after each session
- Stop background services (databases, servers, containers)
- Archive logs or debug information
- Commit/Stash/Push changes automatically
- Trigger builds on project close
- Update documentation automatically
- Close connections to remote servers
- Release file locks or temporary resources
- Stop Docker containers or VMs
- Cleanup memory-intensive processes
Shutdown Tasks configuration is stored in .idea/workspace.xml.
Project Closing (File → Close Project):
- ✅ Tasks executed with the progress dialog visible
- ✅ You can see and cancel execution
- ✅ The IDE waits for tasks until the timeout expires.
IDE Closing (File → Exit or close window):
- ✅ Tasks executed automatically (projects close triggers them)
⚠️ No progress dialog shown (IDE closes immediately)⚠️ Tasks run in background during shutdown- 💡 Tip: Use "Close Project" first if you want to monitor tasks
Recommendation:
- Use
File → Close Projectto see progress
Due to IntelliJ Platform limitations, the plugin cannot reliably detect when a task completes. Or your task may take longer than the timeout.
Therefore:
- Tasks are launched and may be visible in the Run tool window
- The progress dialog waits for the configured timeout
- After timeout, the IDE continues closing
- Tasks execute in sequential order (one after another)
- Failed tasks don't prevent subsequent tasks from running
- Task output may be visible in the Run tool window
- Errors are logged to
idea.log
- ✅ Keep tasks short - Users expect quick shutdown
- ✅ Test your tasks before adding to shutdown
- ✅ Set realistic timeouts - slightly longer than task duration
- ✅ Handle errors gracefully in your scripts
⚠️ Avoid interactive tasks - No user input during shutdown
Problem: Tasks configured but nothing happens on project close.
Solutions:
- Check if tasks are enabled in Settings
- Verify run configurations still exist
⚠️ Please verify that the “Shell Script” (or other) tasks do not have the “Run in the terminal” option selected.- Check
idea.logfor errors (Help → Show Log in Explorer/Finder)
Problem: Task configured but appears to do nothing.
Solutions:
- Test the run configuration manually first
- Check task output in Run tool window
- Make sure that the actions are carried out; the task may not display anything but still works.
- Verify script paths and permissions
- Add error handling to your scripts
Problem: Want to see what tasks are doing.
Solutions:
⚠️ Please verify that the “Shell Script” (or other) tasks do not have the “Run in the terminal” option selected.- Check Run tool window tabs for each task's output
- ¯\_(ツ)_/¯
- IntelliJ IDEA 2025.2+ or compatible IDE
- JDK 21+
- Gradle 8.14+
# Build plugin
./gradlew buildPlugin
# Run in development IDE
./gradlew runIde
# Run tests
./gradlew testshutdown-tasks/
├── src/main/kotlin/dev/gdw/shutdowntasks/
│ ├── listeners/
│ │ └── ShutdownTasksProjectCloseListener.kt # Project close listener
│ ├── settings/
│ │ └── ShutdownTasksState.kt # State persistence
│ ├── ui/
│ │ ├── RunnerAndConfigurationSettingsListCellRenderer.kt # UI renderer
│ │ ├── RunnerAndConfigurationSettingsSelectionDialog.kt # Task selection dialog
│ │ └── ShutdownTasksConfigurable.kt # Settings UI
│ ├── utils/
│ │ ├── RunnerAndConfigurationSettingsUtils.kt # RunnerAndConfigurationSettings Utility
│ │ └── ShutdownTasksRunner.kt # Tasks executor
│ └── ShutdownTasksBundle.kt # Intl
├── src/main/resources/
│ ├── META-INF/
│ │ ├── plugin.xml # Plugin descriptor
│ │ └── pluginIcon.svg # Plugin icon
│ └── messages/ # Translation files
│ ├── ShutdownTasksBundle.properties
│ └── ShutdownTasksBundle_fr.properties
├── build.gradle.kts # Build configuration
└── README.md
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- 🐛 Bug Reports: GitHub Issues
- 💡 Feature Requests: GitHub Issues
- Inspired by IntelliJ IDEA's built-in "Startup Tasks" feature
- Built with IntelliJ Platform Plugin SDK
Made with ❤️ by GDW




