mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-05-14 13:51:33 +00:00
* admin: add plugin lock coordination
* shell: allow bypassing lock checks
* plugin worker: add admin script handler
* mini: include admin_script in plugin defaults
* admin script UI: drop name and enlarge text
* admin script: add default script
* admin_script: make run interval configurable
* plugin: gate other jobs during admin_script runs
* plugin: use last completed admin_script run
* admin: backfill plugin config defaults
* templ
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
* comparable to default version
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
* default to run
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
* format
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
* shell: respect pre-set noLock for fix.replication
* shell: add force no-lock mode for admin scripts
* volume balance worker already exists
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
* admin: expose scheduler status JSON
* shell: add sleep command
* shell: restrict sleep syntax
* Revert "shell: respect pre-set noLock for fix.replication"
This reverts commit 2b14e8b826.
* templ
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
* fix import
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
* less logs
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
* Reduce master client logs on canceled contexts
* Update mini default job type count
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
44 lines
813 B
Go
44 lines
813 B
Go
package shell
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"strconv"
|
|
"time"
|
|
)
|
|
|
|
func init() {
|
|
Commands = append(Commands, &commandSleep{})
|
|
}
|
|
|
|
// =========== Sleep ==============
|
|
type commandSleep struct {
|
|
}
|
|
|
|
func (c *commandSleep) Name() string {
|
|
return "sleep"
|
|
}
|
|
|
|
func (c *commandSleep) Help() string {
|
|
return `sleep for N seconds (useful to simulate long running jobs)
|
|
|
|
sleep 5
|
|
`
|
|
}
|
|
|
|
func (c *commandSleep) HasTag(CommandTag) bool {
|
|
return false
|
|
}
|
|
|
|
func (c *commandSleep) Do(args []string, _ *CommandEnv, _ io.Writer) error {
|
|
if len(args) == 0 {
|
|
return fmt.Errorf("sleep requires a seconds argument")
|
|
}
|
|
seconds, err := strconv.Atoi(args[0])
|
|
if err != nil || seconds <= 0 {
|
|
return fmt.Errorf("sleep duration must be a positive integer, got %q", args[0])
|
|
}
|
|
time.Sleep(time.Duration(seconds) * time.Second)
|
|
return nil
|
|
}
|