I have tried multiple ways to save the output and error file to get current time as file names of respective files still couldnt match the expected outcome.
#!/bin/bash
#PBS -l select=1:ncpus=2:mem=1GB,walltime=00:02:00
#PBS -N PBS_test
#PBS -V
#PBS -o "path_to _dir/output_$(date +%Y%m%d_%H%M%S).log"
#PBS -e "path_to _dir/error_$(date +%Y%m%d_%H%M%S).log"
#PBS -q Hercules
#PBS -v CONTAINER_IMAGE=docker_img
#rest of my PBS commands.
current o/p:output_$(date +%Y%m%d_%H%M%S).log
expected o/p:
type here
output_20230417_060100.log
same goes with the error file.
I wrote a wrapper shell-script to compute
dateand then add this to the output. Once this is done, the wrapper submits the job, appending the precomputed date to the filename of the LOG/ERR. For example:All the suspension points (...) mark eluded code. The
$ARGSvariable is the program you would like to launch, including command-line options and stored as a string. To use it (I have it on $PATH):qsub-wrapper.sh -N jobname123 -t 12 (...options...) script.py file1.tsv file2.tsvI feel it can be cumbersome to employ sometimes, and I think you can sort log-files by using
ls --time=birth -tl. I now have started to dislike the large filenames preppended with dates. However, I still love to have the qsub command, date, etc. as the header of the LOG file.