Changing kill-script name and path
Scheme file attached below would create $HOME/kill-fluent<PID> script in user specified directory. Name of the script file could also be changed. The usuage of which is as follows: 1)Either load the scheme file through (load 'kill-script) or put the complete function(content in kill-script.scm) in $HOME/.fluent file. 2)Then execute following commands in Fluent console(with braces included) in the same sequence: (remove kill-script-filename) (write-kill-script "Your/chosen/dir" "My_file_name") or (write-kill-script "Your/chosen/dir") ;; Default file name will be taken This will write the kill-script file as Your/chosen/dir/My_file_name. (or default file that is, kill-script$CORTX_PID). If you wish to use new name, first argument giving directory path must be provided. ***********************kill-script.scm*************************************** (define (write-kill-script . args) (if (not (or (nt?) (file-exists? kill-script-filename))) (set! kill-script-filename (format #f "~a/kill-fluent~a" (getenv "HOME") (if (rp-sge?) (getenv "JOB_ID") (number->string (cx-cortex-id)))))) (if (not (nt?)) (begin (if (and (pair? args ) (car args)) (if (file-directory? (car args)) (set! kill-script-filename (string-append (car args) "/" (if (pair? (cdr args)) (cadr args) (format #f "kill-fluent~a" (if (rp-sge?) (getenv "JOB_ID") (number->string (cx-cortex-id))))))) (format " Argument given is not a valid directory "))) (with-output-to-file kill-script-filename (lambda () (format "#!/bin/shnn") (format "# This file was generated by FLUENT. To kill FLUENT and all itsn# related processes, chmod +x ~a and run this script. Ifn# FLUENT exits normally, this file will be removed automatically.nn" kill-script-filename) (format "if [ `/bin/uname` = HP-UX ]; thenntREMOTE_SH=remshnelsentREMOTE_SH=rshnfinn") (if (rp-host?) (for-each (lambda (p) (format "$REMOTE_SH ~a kill -9 ~an" (car p) (car (cdr p)))) (%get-process-ids))) (format "$REMOTE_SH ~a kill -9 ~an" (if (pair? (parse-string (cx-client-host) '(#.))) (car (parse-string (cx-client-host) '(#.))) (cx-client-host)) (cx-client-id)) (format "$REMOTE_SH ~a kill -9 ~an" (cx-cortex-host) (cx-cortex-id)) (format "/bin/rm -f ~a" kill-script-filename))) (format "nnKill script file is ~a~%" kill-script-filename)))) |
||
![]()
|