How to run putty with -m command line *and* get log?
I'd like to launch putty and run my script automatically, it works, but I can't save the logs (I need them to debug)!
The way I call putty:
"D:\Some-Path\putty\PUTTY.EXE" -t -load "Server - 111.22.33.444" -l root -m "D:\Cmd\param-1.sh"
param-1.sh
contains two lines:
cd /full/path/
sudo bash /full/path/long_process.sh "param 1" "param-2.txt" "param 3" 0
It works just fine, but if I change param-1.sh
to get the script execution logs, ie.
sudo bash /full/path/long_process.sh "param 1" "param-2.txt" "param 3" 0 > /path/_Logs/param-1.txt &
No log is saved, in fact the script isn't even executed!
I tried adding nohup
before the sudo bash...
, it didn't work either
Anyone knows how to fix this?
Solution 1:
With the &
at the end, you put the process into the background, preventing sudo
from running properly. Why did you add it if it isn't required in the non-logging version?