Skip to content

Instantly share code, notes, and snippets.

@weiofcn
Created August 22, 2018 02:02
Show Gist options
  • Select an option

  • Save weiofcn/8f9d7ef4b2d601797d42f2f61a500144 to your computer and use it in GitHub Desktop.

Select an option

Save weiofcn/8f9d7ef4b2d601797d42f2f61a500144 to your computer and use it in GitHub Desktop.

Revisions

  1. weiofcn created this gist Aug 22, 2018.
    33 changes: 33 additions & 0 deletions xshell.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    ```shell
    Sub Main
    xsh.Screen.Send("export update_dir=/root/zhouwei/")
    xsh.Screen.Send(VbCr)
    xsh.Screen.Send("cd /data && rm -rf `date +%Y%m%d` && cd $update_dir && rm * -rf")
    xsh.Screen.Send(VbCr)
    xsh.Screen.Send("scp [email protected]:/root/soc_env/CloudSocEnv*.tar.gz .")
    xsh.Screen.Send(VbCr)
    xsh.Screen.WaitForString "[email protected]'s password:"
    xsh.Screen.Send("kenchow")
    xsh.Screen.Send(VbCr)
    xsh.Session.Sleep 3000
    xsh.Screen.Send("scp [email protected]:/root/soc/CloudSOC*.tar.gz .")
    xsh.Screen.Send(VbCr)
    xsh.Screen.WaitForString "[email protected]'s password:"
    xsh.Screen.Send("kenchow")
    xsh.Screen.Send(VbCr)
    xsh.Session.Sleep 3000
    xsh.Screen.Send("ls *.tar.gz | xargs -n1 tar xzvf")
    xsh.Screen.Send(VbCr)
    xsh.Session.Sleep 1000
    xsh.Screen.Send("cd /virus && rm -Rf */ && cd $update_dir")
    xsh.Screen.Send(VbCr)
    xsh.Screen.Send("cd `ls -d */ | tail -1` && cd update && sh update.sh")
    xsh.Screen.Send(VbCr)
    xsh.Session.Sleep 1000
    xsh.Screen.Send("cd ../.. && cd `ls -d */ | head -1` && cd update && sh update.sh")
    xsh.Screen.Send(VbCr)
    xsh.Session.Sleep 1000
    xsh.Screen.Send("cd $update_dir && ps -ef | grep python")
    xsh.Screen.Send(VbCr)
    End Sub
    ````