I am running a hive script from within WinSCP (as it allows me to do simple edits to my file as well as run them using file custom commands or via the terminal).
Currently, I'm using the following as a custom command (just right clicking on the file and running this, makes the task very convenient):
nohup /location/platform/cloak/bin/cloak-hive -f ! >> script_temp.log 2>&1 &
which creates a log file the first time and for each subsequent run, the same file gets appended. Ideally I would want the log file to take the name from the !
pattern and expand it to filename.log
. If that is not possible, I'd want to have a timestamp added to the filename.
Aim is to get different logs for different runs, but without changing the custom command each time. I have seen various solutions to append the timestamp after the file is created, but I need to get the name correct with the custom command itself for convenience and tracking. The server being accessed by WinSCP is running RHEL 7.8.
question from:
https://stackoverflow.com/questions/65886311/custom-command-in-winscp-which-creates-a-log-file-with-timestamp-at-the-time-of 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…