Login or Register to Ask a Question and Join Our Community


An curious idea, how to make it by the powerful script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting An curious idea, how to make it by the powerful script?
# 1  
Old 02-03-2010
An curious idea, how to make it by the powerful script?

I use a simple script to do some quantum calculations with gaussian package. the script as follows
Code:
#!/bin/sh

#put a gaussian input file into a new folder in the same name
#and submit this new job

for i in *.gjf
  do
        FN=$( echo $i | sed 's/.gjf//')
        mkdir $FN
        mv $FN.gjf ./$FN
        cp ./g03.sh ./$FN
        mv ./$FN/g03.sh ./$FN/OPT-$FN
        cd $FN
        qsub -V OPT-$FN
        cd ..
  done

#END

It works fine. The general function of this simple script is going: 1. to list the input file in the present folder; 2. to create a folder with the same name; 3. to move the input file into this newly created folder; 4. to submit it.

I would like to know how to add two extra functions into this script:
1. If the job fails, it always leave a very large file name core.*. How to remove it automatically.
2. A checkpoint file named <jobname>.chk will be generated by gaussian package. How to do execute the following command "formchk <jobname>.chk" immediately after the job finished.

It should not be a strange idea. what I don't know is how to know when the job finished.

Please helps.

Thank you in advance!

ZHEN, from Shanghai, China.
# 2  
Old 02-03-2010
from the two point mentioned:

1. removing core files:
Code:
rm -f core # for removing single core file

find . -type f -name "core" -exec rm -f {} \; # for removing core files present in the current dir or subdir.

2. if the <jobname>.chk is present in the current dir.

Code:
if [ -f "<jobname>.chk" ]; then
 formchk <jobname>.chk
fi

you can put the commands in order to how you want to execute them.
if you are having directory other them current dir, then use the absolute path for the file.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Idea to make a function as microservice

Hello - I wrote few scripts on bash shell script and grafana triggers those scripts and show on console . I want to write the console output to a log file as well by using tee command and I am successful as well . I am wondering Instead of writing same logic on multiple scripts , why... (4 Replies)
Discussion started by: Varja
4 Replies

2. Shell Programming and Scripting

I have no idea what is wrong with my simple script.

I am doing a simple "recycle bin" script. It is to check and see if the directory .TRASH exists within the home directory. If not then it makes the directory then appends a date and time to file and then finally moves the file in. However, when I run this script, it is not making the directory as... (5 Replies)
Discussion started by: iamdeman
5 Replies

3. Shell Programming and Scripting

need a new idea for a script

Hi all, I now have project in UNIX Solaris and I want to have some new ideas to execute it, so I hope you help me finding new ideas in scripting or some infrastructure .bye (1 Reply)
Discussion started by: hard_revenge
1 Replies

4. Shell Programming and Scripting

Bash script idea using cUrl -- possible?

I have an alias already in my .bash_profile to download files using cUrl's -o (output to file, user provides the file name) option. I find I'm using it quite a bit, so I wanted to write a script to run "curl -o", taking the necessary inputs - file name and URL from which to download - and then... (3 Replies)
Discussion started by: SilversleevesX
3 Replies

5. Shell Programming and Scripting

Script Idea's / Help

Hi there, I'm pretty new to scripting and wondering if anyone had any idea's, scripts or snippets on how I can do the following. I basically want a shell script that will look at all the files in a directory and find all the names and addresses in them then output them to the screen nicely... (12 Replies)
Discussion started by: mrpugster
12 Replies

6. Shell Programming and Scripting

Any way to make scp more powerful?

Hello, I'm writing a script to automate the delivery of our code to different target environments and I was wondering if there's any way to cut down on the number of authentications that are needed. The script has to deliver to three different boxes (two directories on two boxes and one... (11 Replies)
Discussion started by: pallak7
11 Replies

7. Shell Programming and Scripting

idea for script - cheking passwords

Hi All, I am looking for scripts where i need check normal user password and root password for more 100 servers from single server...! let me explin it what exacltly i need...! i need to do password audit for more than 600 boxes... :o for one normal user and root password also...... (5 Replies)
Discussion started by: bullz26
5 Replies

8. Shell Programming and Scripting

Limitations of awk? Good idea? Bad idea?

Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts.. I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies
Login or Register to Ask a Question

Featured Tech Videos