彡 (゜) (゜) "I want to use Gaussian by a method other than accessing from off-campus."
彡 (゜) (゜) "Saya, if you throw a file into a specified folder on the calculator, you can call it automatically!"
彡 (゜) (゜) "If so, you can do it ()"
Cron on CentOS
python3 and its libraries
auto.py
import os
import subprocess
path = '******'
A=os.listdir(path)
C=[i for i in A if '.com' in i] #Create a list of files you want to calculate
L=[i.replace('.log', '.com') for i in A if '.log' in i] #Creating a list of completed files
G=[i for i in C if i not in L] #Extract uncalculated files
command1 = 'ps ax |grep g09 | grep -v grep | wc -l'
command2 = 'cd ****** | g09 '
res = subprocess.check_output(command1, shell=True)
try:
if res==b'0\n':
print("Computable")
subprocess.Popen(command2 + G[0] + '&', shell=True)
print("Performed the calculation")
else:
print("Under calculation")
except IndexError:
print("There is no file to calculate")
*/30 * * * * /usr/bin/tcsh ./autopy.sh >>& /*******/analog-err.log
I couldn't run the python program directly due to various reasons, so I'm using a roundabout method.
About the matter that took a lot of time to notice that Path of gaussian etc. did not pass by cron
It was troublesome to set the Path one by one, so
I am doing a power technique such as pasting the result of printenv
to cron
So the actual content of cron is longer
Also, of pythonps ax |grep g09 | grep -v grep | wc -l
Did not come up with it on its own
How can I know the job execution status on the net?
I just searched and played with the things that got caught
This was the biggest challenge in this program ...
This is working fine in my environment
Please let me know if there is something like "Isn't it smarter if I do this?" (Beggar)
However, I don't like kid who has a good idea that it makes sense to use python?
As my next goal, I would like to be able to automate the transmission and transfer of files.
I can transfer it, but I can send it ...
In the end, I wanted to create a GUI ...
I wonder if that can be managed with Go language
The end
Recommended Posts