debeando / notifyme Goto Github PK
View Code? Open in Web Editor NEWExecute command in bash and wait to finish to send notification via slack
Execute command in bash and wait to finish to send notification via slack
Capture stdout from running process and send two type of notifications, a pool of this stdout and when is finished.
This example capture stdout from pt-online-schema-change
strace -p24240 -s64 -e trace=write 2>&1 | grep Copying
To prevent use tmux
or screen
tools, own tool run to detach from it.
Trace:
fatal error: runtime: out of memory
runtime stack:
runtime.throw(0x693472, 0x16)
/usr/local/go/src/runtime/panic.go:616 +0x81
runtime.sysMap(0xc440200000, 0x20000000, 0x0, 0x810d98)
/usr/local/go/src/runtime/mem_linux.go:216 +0x20a
runtime.(*mheap).sysAlloc(0x7f7d60, 0x20000000, 0x0)
/usr/local/go/src/runtime/malloc.go:470 +0xd4
runtime.(*mheap).grow(0x7f7d60, 0x10000, 0x0)
/usr/local/go/src/runtime/mheap.go:907 +0x60
runtime.(*mheap).allocSpanLocked(0x7f7d60, 0x10000, 0x810da8, 0xc420001980)
/usr/local/go/src/runtime/mheap.go:820 +0x301
runtime.(*mheap).alloc_m(0x7f7d60, 0x10000, 0xffffffffffff0101, 0xc420107f10)
/usr/local/go/src/runtime/mheap.go:686 +0x118
runtime.(*mheap).alloc.func1()
/usr/local/go/src/runtime/mheap.go:753 +0x4d
runtime.(*mheap).alloc(0x7f7d60, 0x10000, 0xc420010101, 0x43189f)
/usr/local/go/src/runtime/mheap.go:752 +0x8a
runtime.largeAlloc(0x1ffffe00, 0x7fb930e10101, 0x431001)
/usr/local/go/src/runtime/malloc.go:826 +0x94
runtime.mallocgc.func1()
/usr/local/go/src/runtime/malloc.go:721 +0x46
runtime.systemstack(0x0)
/usr/local/go/src/runtime/asm_amd64.s:409 +0x79
runtime.mstart()
/usr/local/go/src/runtime/proc.go:1175
goroutine 8 [running]:
runtime.systemstack_switch()
/usr/local/go/src/runtime/asm_amd64.s:363 fp=0xc42004aca0 sp=0xc42004ac98 pc=0x451ef0
runtime.mallocgc(0x1ffffe00, 0x62e080, 0xc440121501, 0xc42004ad78)
/usr/local/go/src/runtime/malloc.go:720 +0x8a2 fp=0xc42004ad40 sp=0xc42004aca0 pc=0x40faf2
runtime.makeslice(0x62e080, 0x1ffffe00, 0x1ffffe00, 0x4a61ba, 0xc42000c058, 0xc4401215c1)
/usr/local/go/src/runtime/slice.go:61 +0x77 fp=0xc42004ad70 sp=0xc42004ad40 pc=0x43e707
bytes.makeSlice(0x1ffffe00, 0x0, 0x0, 0x0)
/usr/local/go/src/bytes/buffer.go:230 +0x6d fp=0xc42004adb0 sp=0xc42004ad70 pc=0x4668cd
bytes.(*Buffer).grow(0xc420112000, 0x200, 0xe83f)
/usr/local/go/src/bytes/buffer.go:144 +0x151 fp=0xc42004ae00 sp=0xc42004adb0 pc=0x466281
bytes.(*Buffer).ReadFrom(0xc420112000, 0x6bf860, 0xc42000c058, 0x7fb930e18030, 0xc420112000, 0x1)
/usr/local/go/src/bytes/buffer.go:204 +0x48 fp=0xc42004ae70 sp=0xc42004ae00 pc=0x4666e8
io.copyBuffer(0x6bf3c0, 0xc420112000, 0x6bf860, 0xc42000c058, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:386 +0x31a fp=0xc42004aee0 sp=0xc42004ae70 pc=0x45e0fa
io.Copy(0x6bf3c0, 0xc420112000, 0x6bf860, 0xc42000c058, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:362 +0x5a fp=0xc42004af40 sp=0xc42004aee0 pc=0x45dd9a
os/exec.(*Cmd).writerDescriptor.func1(0x0, 0x0)
/usr/local/go/src/os/exec/exec.go:275 +0x4d fp=0xc42004afa0 sp=0xc42004af40 pc=0x600fbd
os/exec.(*Cmd).Start.func1(0xc4200a49a0, 0xc4200d6280)
/usr/local/go/src/os/exec/exec.go:396 +0x27 fp=0xc42004afd0 sp=0xc42004afa0 pc=0x601037
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc42004afd8 sp=0xc42004afd0 pc=0x4548c1
created by os/exec.(*Cmd).Start
/usr/local/go/src/os/exec/exec.go:395 +0x5df
goroutine 1 [syscall]:
syscall.Syscall6(0xf7, 0x1, 0x78d6, 0xc420045a48, 0x1000004, 0x0, 0x0, 0x0, 0xc420034400, 0x0)
/usr/local/go/src/syscall/asm_linux_amd64.s:44 +0x5
os.(*Process).blockUntilWaitable(0xc4200144e0, 0x0, 0x0, 0x3)
/usr/local/go/src/os/wait_waitid.go:31 +0x98
os.(*Process).wait(0xc4200144e0, 0xc42005ecf0, 0xc4200a4a78, 0xc4200a4a78)
/usr/local/go/src/os/exec_unix.go:22 +0x3c
os.(*Process).Wait(0xc4200144e0, 0x6a19b0, 0x6a19b8, 0x6a19a8)
/usr/local/go/src/os/exec.go:123 +0x2b
os/exec.(*Cmd).Wait(0xc4200a49a0, 0x0, 0x0)
/usr/local/go/src/os/exec/exec.go:461 +0x5c
os/exec.(*Cmd).Run(0xc4200a49a0, 0xc42006c230, 0x2)
/usr/local/go/src/os/exec/exec.go:305 +0x5c
os/exec.(*Cmd).Output(0xc4200a49a0, 0x4, 0xc420045cc0, 0x2, 0x2, 0xc4200a49a0)
/usr/local/go/src/os/exec/exec.go:500 +0xf5
main.exec_command(0xc420108090, 0x81, 0xc420045eb8, 0x1, 0x1)
/Users/swapbyt3s/go/src/github.com/swapbyt3s/notifyme/main.go:107 +0x97
main.main()
/Users/swapbyt3s/go/src/github.com/swapbyt3s/notifyme/main.go:61 +0x2be
goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
/usr/local/go/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
/usr/local/go/src/os/signal/signal_unix.go:28 +0x41
goroutine 6 [select, locked to thread]:
runtime.gopark(0x6a1d40, 0x0, 0x68ef37, 0x6, 0x18, 0x1)
/usr/local/go/src/runtime/proc.go:291 +0x11a
runtime.selectgo(0xc420032750, 0xc42001c1e0)
/usr/local/go/src/runtime/select.go:392 +0xe50
runtime.ensureSigM.func1()
/usr/local/go/src/runtime/signal_unix.go:549 +0x1f4
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2361 +0x1
goroutine 7 [chan receive]:
main.wait_for_interrupt.func1(0xc420054120)
/Users/swapbyt3s/go/src/github.com/swapbyt3s/notifyme/main.go:95 +0x38
created by main.wait_for_interrupt
/Users/swapbyt3s/go/src/github.com/swapbyt3s/notifyme/main.go:94 +0xed
goroutine 9 [IO wait]:
internal/poll.runtime_pollWait(0x7fb930e17d60, 0x72, 0xc420033d58)
/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc42006c388, 0x72, 0xffffffffffffff01, 0x6c0160, 0x7bc190)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc42006c388, 0xc420114001, 0x8000, 0x8000)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc42006c370, 0xc420114000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:157 +0x17d
os.(*File).read(0xc42000c070, 0xc420114000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
/usr/local/go/src/os/file_unix.go:226 +0x4e
os.(*File).Read(0xc42000c070, 0xc420114000, 0x8000, 0x8000, 0x5f, 0x0, 0x0)
/usr/local/go/src/os/file.go:107 +0x6a
io.copyBuffer(0x6bf940, 0xc42006c230, 0x6bf860, 0xc42000c070, 0xc420114000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:400 +0x164
io.Copy(0x6bf940, 0xc42006c230, 0x6bf860, 0xc42000c070, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:362 +0x5a
os/exec.(*Cmd).writerDescriptor.func1(0x0, 0x0)
/usr/local/go/src/os/exec/exec.go:275 +0x4d
os/exec.(*Cmd).Start.func1(0xc4200a49a0, 0xc4200d62c0)
/usr/local/go/src/os/exec/exec.go:396 +0x27
created by os/exec.(*Cmd).Start
/usr/local/go/src/os/exec/exec.go:395 +0x5df
Convert seconds to human unit, example: minutes, hours, days, etc...
The idea is to not use tmux or screen tools to leave in backgroud this process.
For example:
Should by notifymy "ls"
and not notifymy ls
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.