[PYTHON] I want to make an automation program!

start

彡 (゜) (゜) "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 ()"

Things used

Cron on CentOS

python3 and its libraries

Real

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.

Clogged place

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 -lDid 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 ...

At the end

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?


Why is there no job manager in my lab (bloody tears)

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

I want to make an automation program!
I want to make matplotlib a dark theme
I want to make a game with Python
I want to be an OREMO with setParam!
I want to make fits from my head
I want to make C ++ code from Python code!
I want to convert an image to WebP with lollipop
I want to develop an Android application on Android (debugging)
I want to solve Sudoku (Sudoku)
[Python] I want to make a nested list a tuple
I want to make an SFC physical education reservation system monitoring system (β version)
I tried to make an OCR application with PySimpleGUI
I want to make a blog editor with django admin
I want to make a click macro with pyautogui (desire)
I want to make a click macro with pyautogui (outlook)
I want to convert an ISO-8601 character string to Japan time
I want to make the Dictionary type in the List unique
I want to make input () a nice complement in python
I didn't want to write the AWS key in the program
I want to understand systemd roughly
I want to scrape images to learn
I want to do ○○ with Pandas
I want to copy yolo annotations
I want to debug with Python
I tried to make an activity that collectively sets location information
I tried to make an analysis base of 5 patterns in 3 years
[Introduction] I want to make a Mastodon Bot with Python! 【Beginners】
I want to make a parameter list from CloudFormation code (yaml)
I want to make the second line the column name in pandas
[Python] Simple Japanese ⇒ I tried to make an English translation tool
I tried to make an image similarity function with Python + OpenCV
I want to pin Spyder to the taskbar
I want to detect objects with OpenCV
I want to output to the console coolly
I want to print in a comprehension
I want to scrape them all together.
I want to handle the rhyme part1
I want to know how LINUX works!
I want to blog with Jupyter Notebook
I want to handle the rhyme part3
I want to use jar from python
I want to build a Python environment
I want to use Linux on mac
I want to pip install with PythonAnywhere
An introductory guide to program performance tuning
I want to analyze logs with Python
I want to play with aws with python
I want to use IPython Qt Console
I want to display the progress bar
I tried to make a Web API
I want to embed Matplotlib in PySimpleGUI
I want to handle the rhyme part2
I want to develop Android apps on Android
I want CAPTCHA to say HIWAI words
I want to handle the rhyme part5
I want to handle the rhyme part4
I want to operate DB using Django's ORM from an external application
Tips for manipulating numpy.ndarray from c ++ -I want to use an iterator-
I tried to make an open / close sensor (Twitter cooperation) with TWE-Lite-2525A
Note: I want to do home automation with Home Assistant + Raspberry Pi + sensor # 1
I want to display an image on Jupyter Notebook using OpenCV (mac)