do automate things on Linux
Project description
# auto_everything
Linux system automation
#### Installation
```
wget https://github.com/yingshaoxo/auto_everything/raw/master/env_setup.sh
sudo bash env_setup.sh
```
#### Magic
```
wget https://github.com/yingshaoxo/auto_everything/raw/master/demo/install_YouCompleteMe.py
sudo python3 install_YouCompleteMe.py
```
#### Import
```
from auto_everything.base import Terminal
t = Terminal()
```
#### Run a command & get reply
```
reply = t.run_command('uname -a')
print(reply)
```
#### Run commands & wait until it was finished
```
commands = """
sudo apt update
uname -a
"""
t.run(commands, wait=True)
```
#### Run a program
`t.run_program('firefox')`
#### Run a python script
`t.run_py('your_python_file_path')`
#### Run a bash script
`t.run_sh('your_.sh_file_path')`
#### Detect if a program or script is running
```
status = t.is_running('terminal')
print(status)
```
#### Keep a function running
```
from auto_everything.base import Python
py = Python()
i = 0
@py.loop(thread=False)
def count():
global i
i += 1
print(i)
count()
print("Welcome to my world!")
```
#### Create a systemd serviece
```
from auto_everything.base import Super
s = Super(username="yingshaoxo")
s.start_service("service_name", "your_python_file_path")
#s.stop_service("service_name")
```
#### Web automation
```
from auto_everything.web import Selenium
from time import sleep
my_selenium = Selenium("https://www.google.com")
d = my_selenium.driver
# get input box
xpath = '//*[@id="lst-ib"]'
element = my_selenium.wait_until_exists(xpath)
# text inputing
element.send_keys('\b' * 20, "yingshaoxo")
# click search button
element = my_selenium.wait_until_exists('//*[@id="tsf"]/div[2]/div[3]/center/input[1]')
element.click() # d.execute_script("arguments[0].click();", element)
# exit
"""
sleep(3)
d.quit()
"""
```
Linux system automation
#### Installation
```
wget https://github.com/yingshaoxo/auto_everything/raw/master/env_setup.sh
sudo bash env_setup.sh
```
#### Magic
```
wget https://github.com/yingshaoxo/auto_everything/raw/master/demo/install_YouCompleteMe.py
sudo python3 install_YouCompleteMe.py
```
#### Import
```
from auto_everything.base import Terminal
t = Terminal()
```
#### Run a command & get reply
```
reply = t.run_command('uname -a')
print(reply)
```
#### Run commands & wait until it was finished
```
commands = """
sudo apt update
uname -a
"""
t.run(commands, wait=True)
```
#### Run a program
`t.run_program('firefox')`
#### Run a python script
`t.run_py('your_python_file_path')`
#### Run a bash script
`t.run_sh('your_.sh_file_path')`
#### Detect if a program or script is running
```
status = t.is_running('terminal')
print(status)
```
#### Keep a function running
```
from auto_everything.base import Python
py = Python()
i = 0
@py.loop(thread=False)
def count():
global i
i += 1
print(i)
count()
print("Welcome to my world!")
```
#### Create a systemd serviece
```
from auto_everything.base import Super
s = Super(username="yingshaoxo")
s.start_service("service_name", "your_python_file_path")
#s.stop_service("service_name")
```
#### Web automation
```
from auto_everything.web import Selenium
from time import sleep
my_selenium = Selenium("https://www.google.com")
d = my_selenium.driver
# get input box
xpath = '//*[@id="lst-ib"]'
element = my_selenium.wait_until_exists(xpath)
# text inputing
element.send_keys('\b' * 20, "yingshaoxo")
# click search button
element = my_selenium.wait_until_exists('//*[@id="tsf"]/div[2]/div[3]/center/input[1]')
element.click() # d.execute_script("arguments[0].click();", element)
# exit
"""
sleep(3)
d.quit()
"""
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for auto_everything-1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 779e79ba696c0b815a1ff22a5167de2e6b87c9c855d9e06b578ccd49cba043e4 |
|
MD5 | 73b5ef8532e29857e91b2da94de5778c |
|
BLAKE2b-256 | 010774511d5cc07fc82cccfc61e6c6b1e3321dde38efaaca743397c879d718b3 |