# How to use ssh execute other shell script on other host (shell script include nohup)?

**URL:** <https://community.unix.com/t/how-to-use-ssh-execute-other-shell-script-on-other-host-shell-script-include-nohup/277603>\
**Category:** Shell Programming and Scripting\
**Created:** [November 18, 2010, 8:21pm UTC](https://community.unix.com/t/how-to-use-ssh-execute-other-shell-script-on-other-host-shell-script-include-nohup/277603 "2010-11-18T20:21:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![orablue](https://community.unix.com/letter_avatar/orablue/32/6_22734026db12803ebb3e059622ac3534.png) [@orablue](https://community.unix.com/u/orablue)\
**Post date:** [November 18, 2010, 8:21pm UTC](https://community.unix.com/t/how-to-use-ssh-execute-other-shell-script-on-other-host-shell-script-include-nohup/277603/1 "2010-11-18T20:21:31Z")

</div>

i want use ssh on the host01 to execute autoexec.sh on the host02 like following :

host01\> ssh host02 autoexec.sh

autoexec.sh include nohup command like follwing :

nohup /home/jack/deletedata.sh &

after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh on the host02, pls help me ,many thanks ...

---

<div class="post-metadata">

**Author:** ![Chubler\_XL](https://community.unix.com/user_avatar/community.unix.com/chubler_xl/32/2077_2.png) [@Chubler\_XL](https://community.unix.com/u/Chubler_XL)\
**Post date:** [November 18, 2010, 8:46pm UTC](https://community.unix.com/t/how-to-use-ssh-execute-other-shell-script-on-other-host-shell-script-include-nohup/277603/2 "2010-11-18T20:46:37Z")

</div>

I'd redirect stdout and stderr to logfiles in the autoexec.sh script eg:

```nohighlight
nohup /home/jeck/deletedata.sh > /home/jack/deletedata.log 2>&1 &

```

Just in case there is some funny issue with deletedata.sh not getting the correct environment, or needing a tty, etc.
