minor change

pull/3/head
Simon Let 7 years ago
parent 05a296d218
commit 8b40a332c1
  1. 5
      bashrc.sh
  2. 21
      collect/resh-collect.go
  3. 2
      common/resh-common.go

@ -2,6 +2,7 @@
PATH=$PATH:~/.resh/bin PATH=$PATH:~/.resh/bin
export __RESH_RT_SESSION=$EPOCHREALTIME export __RESH_RT_SESSION=$EPOCHREALTIME
export __RESH_RT_SESS_SINCE_BOOT=$(cat /proc/uptime | cut -d' ' -f1) export __RESH_RT_SESS_SINCE_BOOT=$(cat /proc/uptime | cut -d' ' -f1)
export __RESH_SESSION_ID=$RANDOM
nohup resh-daemon &>/dev/null & disown nohup resh-daemon &>/dev/null & disown
preexec() { preexec() {
@ -24,7 +25,7 @@ preexec() {
# non-posix # non-posix
__RESH_PID="$BASHPID" # current pid __RESH_PID="$BASHPID" # current pid
__RESH_SESSION_PID="$$" # pid of original shell __RESH_SHELL_PID="$$" # pid but subshells don't affect it
__RESH_WINDOWID="$WINDOWID" # session __RESH_WINDOWID="$WINDOWID" # session
__RESH_HOST="$HOSTNAME" __RESH_HOST="$HOSTNAME"
__RESH_HOSTTYPE="$HOSTTYPE" __RESH_HOSTTYPE="$HOSTTYPE"
@ -54,7 +55,7 @@ precmd() {
-pwd "$__RESH_PWD" \ -pwd "$__RESH_PWD" \
-shell "$__RESH_SHELL" \ -shell "$__RESH_SHELL" \
-term "$__RESH_TERM" \ -term "$__RESH_TERM" \
-pid "$__RESH_PID" -sessionPid "$__RESH_SESSION_PID" \ -pid "$__RESH_PID" -shellPid "$__RESH_SHELL_PID" \
-windowId "$__RESH_WINDOWID" \ -windowId "$__RESH_WINDOWID" \
-host "$__RESH_HOST" \ -host "$__RESH_HOST" \
-hosttype "$__RESH_HOSTTYPE" \ -hosttype "$__RESH_HOSTTYPE" \

@ -45,7 +45,8 @@ func main() {
// non-posix // non-posix
pid := flag.Int("pid", -1, "$PID") pid := flag.Int("pid", -1, "$PID")
sessionPid := flag.Int("sessionPid", -1, "$$") shellPid := flag.Int("shellPid", -1,
"$$ (pid but subshells don't affect it)")
windowId := flag.Int("windowId", -1, "$WINDOWID - session id") windowId := flag.Int("windowId", -1, "$WINDOWID - session id")
shlvl := flag.Int("shlvl", -1, "$SHLVL") shlvl := flag.Int("shlvl", -1, "$SHLVL")
@ -104,14 +105,14 @@ func main() {
Term: *term, Term: *term,
// non-posix // non-posix
Pid: *pid, Pid: *pid,
SessionPid: *sessionPid, ShellPid: *shellPid,
WindowId: *windowId, WindowId: *windowId,
Host: *host, Host: *host,
Hosttype: *hosttype, Hosttype: *hosttype,
Ostype: *ostype, Ostype: *ostype,
Machtype: *machtype, Machtype: *machtype,
Shlvl: *shlvl, Shlvl: *shlvl,
// before after // before after
TimezoneBefore: *timezoneBefore, TimezoneBefore: *timezoneBefore,
@ -127,7 +128,7 @@ func main() {
RealtimeSinceBoot: realtimeSinceBoot, RealtimeSinceBoot: realtimeSinceBoot,
GitWorkTree: getGitDir(), GitWorkTree: getGitDir(),
MachineId: getMachineId(), MachineId: getMachineId(),
} }
sendRecord(rec, strconv.Itoa(config.Port)) sendRecord(rec, strconv.Itoa(config.Port))
} }

@ -19,7 +19,7 @@ type Record struct {
// non-posix"` // non-posix"`
Pid int `json:"pid"` Pid int `json:"pid"`
SessionPid int `json:"sessionPid"` ShellPid int `json:"shellPid"`
WindowId int `json:"windowId"` WindowId int `json:"windowId"`
Host string `json:"host"` Host string `json:"host"`
Hosttype string `json:"hosttype"` Hosttype string `json:"hosttype"`

Loading…
Cancel
Save