1
0
mirror of https://github.com/IceWhaleTech/CasaOS.git synced 2025-07-15 23:54:17 +02:00

added google drive and dropbox driver

This commit is contained in:
link
2023-02-02 03:36:59 +00:00
parent 87d8be8c61
commit 28d3ca0ca6
38 changed files with 2004 additions and 389 deletions

View File

@ -2,14 +2,12 @@ package command
import (
"bufio"
"context"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
)
func OnlyExec(cmdStr string) {
@ -98,23 +96,6 @@ func ExecLSBLKByPath(path string) []byte {
return output
}
// exec smart
func ExecSmartCTLByPath(path string) []byte {
timeout := 3
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second)
defer cancel()
output, err := exec.CommandContext(ctx, "smartctl", "-a", path, "-j").Output()
if err != nil {
fmt.Println("smartctl", err)
return nil
}
return output
}
func ExecEnabledSMART(path string) {
exec.Command("smartctl", "-s on", path).Output()
}
func ExecuteScripts(scriptDirectory string) {
if _, err := os.Stat(scriptDirectory); os.IsNotExist(err) {
fmt.Printf("No post-start scripts at %s\n", scriptDirectory)