Send data to script
This commit is contained in:
parent
ef0a20ffe0
commit
9514628710
3 changed files with 20 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ type ScriptExecution struct {
|
|||
TimeStart sql.NullTime `db:"time_start"`
|
||||
TimeEnd sql.NullTime `db:"time_end"`
|
||||
Source []byte
|
||||
Data string
|
||||
Data []byte
|
||||
SSH string
|
||||
OutputStdout sql.NullString `db:"output_stdout"`
|
||||
OutputStderr sql.NullString `db:"output_stderr"`
|
||||
|
|
@ -84,6 +84,13 @@ func (self ScriptScheduler) HandleNextExecution() { // {{{
|
|||
return
|
||||
}
|
||||
|
||||
err = se.RunScript(fname)
|
||||
if err != nil {
|
||||
err = werr.Wrap(err)
|
||||
logger.Error("script_execution", "op", "run_script", "id", se.ID, "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
se.SSHCommand([]byte{}, false, fmt.Sprintf("rm %s", fname))
|
||||
|
||||
logger.Info("script_scheduler", "op", "handled", "script", fname)
|
||||
|
|
@ -192,7 +199,14 @@ func (se *ScriptExecution) GetScriptTempFilename() (fname string, err error) { /
|
|||
return
|
||||
} // }}}
|
||||
func (se *ScriptExecution) UploadScript(fname string) (err error) { // {{{
|
||||
_, err = se.SSHCommand(se.Source, true, fmt.Sprintf("sh -c 'touch %s && chmod 700 %s && cat >%s && %s'", fname, fname, fname, fname))
|
||||
_, err = se.SSHCommand(se.Source, true, fmt.Sprintf("sh -c 'touch %s && chmod 700 %s && cat >%s'", fname, fname, fname))
|
||||
if err != nil {
|
||||
err = werr.Wrap(err)
|
||||
}
|
||||
return
|
||||
} // }}}
|
||||
func (se *ScriptExecution) RunScript(fname string) (err error) { // {{{
|
||||
_, err = se.SSHCommand(se.Data, true, fname)
|
||||
if err != nil {
|
||||
err = werr.Wrap(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,13 +62,14 @@ button {
|
|||
padding: 16px 32px;
|
||||
}
|
||||
#menu .item {
|
||||
font-size: 1.1em;
|
||||
cursor: pointer;
|
||||
}
|
||||
#menu .item.selected {
|
||||
font-weight: bold;
|
||||
}
|
||||
#logo img {
|
||||
height: 96px;
|
||||
height: 64px;
|
||||
margin-right: 32px;
|
||||
}
|
||||
#nodes {
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ button {
|
|||
}
|
||||
|
||||
.item {
|
||||
font-size: 1.1em;
|
||||
cursor: pointer;
|
||||
|
||||
&.selected {
|
||||
|
|
@ -89,7 +90,7 @@ button {
|
|||
|
||||
#logo {
|
||||
img {
|
||||
height: 96px;
|
||||
height: 64px;
|
||||
margin-right: 32px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue