bash - unix - running a shell script in the background and creating an output log -
what's best way run shell script need create output log @ same time run in background? catch is, need input couple of parameters enter password.
for example execute shell script so:
-bash-4.3$ ./tst.sh param1 param2 >> tst.log password user mas: i need pass in (2) parameters, prompted password:
./tsh.sh <param1> <param2> this work, have keep session open , want goes background or similar continue run if connection host fails..
if want run survive if connection fails should run in screen or tmux session. can use create sessions can disconnect , reconnect to, , many other cool things once start getting them.
so if ssh in , run screen you'll still @ bash prompt, if run command press ^a^d detach session. running inside screen keep going, , you'll able reconnect screen -x later. can have many screen sessions @ same time too, use screen -ls see running can use screen -x <id> reconnect particular one.
Comments
Post a Comment