Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hug
- import subprocess
- @hug.get('/status')
- @hug.cli()
- def root():
- out= subprocess.getoutput("/etc/init.d/apache2 status")
- return out
- @hug.get('/apache_start')
- @hug.cli()
- def root():
- out= subprocess.getoutput("/etc/init.d/apache2 start")
- return out
- @hug.get('/apache_stop')
- @hug.cli()
- def root():
- out= subprocess.getoutput("/etc/init.d/apache2 stop")
- return out
- if __name__ == '__main__':
- add.interface.cli()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement