PHPackages                             tourze/server-shell-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. tourze/server-shell-bundle

ActiveSymfony-bundle[CLI &amp; Console](/categories/cli)

tourze/server-shell-bundle
==========================

服务端Shell执行

1.0.1(7mo ago)00MITPHPCI failing

Since May 20Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/tourze/server-shell-bundle)[ Packagist](https://packagist.org/packages/tourze/server-shell-bundle)[ RSS](/packages/tourze-server-shell-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (41)Versions (5)Used By (0)

Server Shell Bundle
===================

[](#server-shell-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/564b4d7a25b6c79dc164aeacb7d3708a20d88c7133320fdd23dbf6709491ff42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f7365727665722d7368656c6c2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/server-shell-bundle)[![PHP Version](https://camo.githubusercontent.com/4c603a9523bd891e5c6a6e72c4bd5adee8f4efae2947047becbd1bf9e0e1b0c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f7365727665722d7368656c6c2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/server-shell-bundle)[![License](https://camo.githubusercontent.com/d0178d808cd3b026a29ff3b9be0e6a4ad8f33273f1e715be5392fc3e79c0c8ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f7365727665722d7368656c6c2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/server-shell-bundle)[![Build Status](https://camo.githubusercontent.com/e2e17a804668652a7d44275e7312f336d5459bfc531e9db4ed3aad57c83db379/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f7068702d6d6f6e6f7265706f2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tourze/php-monorepo)[![Quality Score](https://camo.githubusercontent.com/43930c8561a14d3f5a68c62b692ee20749bac4c043e09e88fd3fdd611660198f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f7068702d6d6f6e6f7265706f2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/php-monorepo)[![Code Coverage](https://camo.githubusercontent.com/fce86ff4532b4694c22512e5e192a270f73dd27d6e5495fffb59c73cf14de807/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f75727a652f7068702d6d6f6e6f7265706f2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/php-monorepo)[![Total Downloads](https://camo.githubusercontent.com/bd6f6345bd91fe8abaeadbfd44f2068fb3eef56598887fbf0086fd0b3e4186d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f7365727665722d7368656c6c2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/server-shell-bundle)

A powerful Symfony bundle for managing and executing shell scripts on remote servers. This bundle provides a comprehensive system for creating, managing, and executing shell scripts across multiple nodes with full execution tracking and asynchronous processing support.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Quick Start](#quick-start)
- [API Reference](#api-reference)
- [Advanced Usage](#advanced-usage)
- [Admin Interface](#admin-interface)
- [Security Considerations](#security-considerations)
- [Dependencies](#dependencies)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- **Script Management**: Create, update, and manage shell scripts with metadata
- **Remote Execution**: Execute scripts on remote nodes via SSH
- **Execution Tracking**: Track script execution status, results, and performance metrics
- **Asynchronous Processing**: Support for async script execution using Symfony Messenger
- **Security**: Configurable sudo execution and script validation
- **EasyAdmin Integration**: Built-in admin interface for script management
- **History &amp; Logging**: Complete execution history with detailed logging
- **Flexible Configuration**: Configurable working directories, timeouts, and execution parameters
- **Tag-based Organization**: Organize scripts with tags for easy categorization

Installation
------------

[](#installation)

```
composer require tourze/server-shell-bundle
```

Configuration
-------------

[](#configuration)

### Bundle Registration

[](#bundle-registration)

Register the bundle in your `config/bundles.php`:

```
return [
    // ... other bundles
    ServerShellBundle\ServerShellBundle::class => ['all' => true],
];
```

### Database Setup

[](#database-setup)

Run migrations to create the required database tables:

```
php bin/console doctrine:migrations:migrate
```

### Script Parameters

[](#script-parameters)

- **name**: Human-readable script name
- **content**: Shell script content
- **workingDirectory**: Directory to execute the script in (default: /tmp)
- **useSudo**: Whether to execute with sudo privileges (default: false)
- **timeout**: Execution timeout in seconds (default: 300)
- **tags**: Array of tags for organization
- **description**: Script description
- **enabled**: Whether the script is enabled for execution (default: true)

### Execution Tracking

[](#execution-tracking)

Each script execution creates a `ScriptExecution` entity that tracks:

- Execution status (PENDING, RUNNING, COMPLETED, FAILED, TIMEOUT, CANCELED)
- Execution results and output
- Execution time and performance metrics
- Associated node and script information
- Exit codes and error information

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
