diff options
author | Thomas White <taw@physics.org> | 2021-03-01 15:28:45 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-03-01 15:28:45 +0100 |
commit | da5e9537d64b58e502cfdfcfbfdc161383d33bc8 (patch) | |
tree | 2f364ea3d18a81c80d6e0e495a3e703b1ea20813 /src/gui_index.c | |
parent | 04f7ec271ce14ab23b38ff005d9fbb61c4f9f6a5 (diff) |
Local BE: Write a script and run it
This easily gives us the stdout.log and stderr.log needed for monitoring
the job.
Diffstat (limited to 'src/gui_index.c')
-rw-r--r-- | src/gui_index.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gui_index.c b/src/gui_index.c index 75bc233f..4862ab72 100644 --- a/src/gui_index.c +++ b/src/gui_index.c @@ -815,3 +815,42 @@ int read_number_processed(const char *filename) return n_proc; } + + +int write_indexamajig_script(const char *script_filename, + const char *geom_filename, + const char *n_thread_str, + const char *files_list, + const char *stream_filename, + struct peak_params *peak_search_params, + struct index_params *indexing_params) +{ + FILE *fh; + int i; + char **cmdline; + + cmdline = indexamajig_command_line(geom_filename, + n_thread_str, + files_list, + stream_filename, + peak_search_params, + indexing_params); + if ( cmdline == NULL ) return 1; + + fh = fopen(script_filename, "w"); + if ( fh == NULL ) return 1; + + fprintf(fh, "#!/bin/sh\n"); + + i = 0; + while ( cmdline[i] != NULL ) { + fprintf(fh, "%s ", cmdline[i]); + free(cmdline[i]); + i++; + }; + free(cmdline); + fprintf(fh, ">stdout.log 2>stderr.log\n"); + + fclose(fh); + return 0; +} |