示例#1
0
#! /usr/bin/env python

import os
import sys
euid = os.geteuid()
if euid != 0:
    print "Script not started as root. Running sudo.."
    args = ['sudo', sys.executable] + sys.argv + [os.environ]
    # the next line replaces the currently-running process with the sudo
    os.execlpe('sudo', *args)

print 'Running. Your euid is', euid
from coffeetimethreading import CoffeeMaker
coffee_maker = CoffeeMaker()
coffee_maker.makeCoffee(16)
示例#2
0
from flask import Flask
import os
import threading
from coffeetimethreading import CoffeeMaker
from functools import wraps
from flask import request, Response
import json
from CoffeeEmail import SendSmallStartEmail
from CoffeeEmail import SendLargeStartEmail
from CoffeeEmail import SendCoffeeCancelledEmail

app = Flask(__name__)
app.secret_key = os.urandom(24)
app.debug = True
coffee_maker = CoffeeMaker()

html = """ 
<!DOCTYPE html>
<html>
<head>
       <style type="text/css">
               input#stopbutton {
                       width: 250px;
                       height: 100px;
                       font-size: 28px;
                       color: #FF0000;
               }
               input#coffeebutton {
                       width: 250px;
                       height: 100px;
                       font-size: 28px;
示例#3
0
文件: stop.py 项目: efinkg/XMPPCode
#! /usr/bin/env python

import os
import sys
euid = os.geteuid()
if euid != 0:
    print "Script not started as root. Running sudo.."
    args = ['sudo', sys.executable] + sys.argv + [os.environ]
    # the next line replaces the currently-running process with the sudo
    os.execlpe('sudo', *args)

print 'Running. Your euid is', euid
from coffeetimethreading import CoffeeMaker
coffee_maker = CoffeeMaker()
coffee_maker.force_stop()