Example #1
0
def create_cronjobs_from_file(file_path):
    if file_path == None:
        print("File with cronjobs not defined. Exit.")
        sys.exit(1)

    print(command_line.exec_command("crontab " + file_path))
    return None
Example #2
0
def set_cronjob(minute, hour, day_of_m, day_of_w, month, command):
    if command == None:
        print("No command defined, exiting")
        sys.exit(1)

    if minute == None:
        exec_minute = "*"
    else:
        exec_minute = minute
        
    if hour == None:
        exec_hour = "*"
    else:
        exec_hour = hour

    if day_of_m == None:
        exec_day_of_m = "*"
    else:
        exec_day_of_m = day_of_m

    if day_of_w == None:
        exec_day_of_w = "*"
    else:
        exec_day_of_w = day_of_w

    if month == None:
        exec_month = "*"
    else:
        exec_month = month

    print(command_line.exec_command("crontab -e {} {} {} {} {} {}".format(exec_minute, exec_hour, exec_day_of_m, exec_day_of_w, exec_month, command)))
    return None
def get_user_confirmation():
    print()
    if input("Everything went alright? Continue?(Y/N)").lower() != "y":
        print("Installation aborted...")
        sys.exit(1)

if __name__ == '__main__':

    
    if sys.version_info[0] < 3:
        print("Please use Python3 for this script...")
        sys.exit(1)

    #Grab needed packages for compilation    
    print("Getting essential packages...")
    print(command_line.exec_command(ESSENTIALS))
    get_user_confirmation()

    print("Cloning MongoDB Github repository...")
    os.chdir("/home/pi/")
    print(command_line.exec_command(CLONE_GIT))
    get_user_confirmation()

    print("The following commands take a lot of time, do you want to continue?(Y/N)")
    if(input().lower() != "y"):
        print("Installation aborted...")
        sys.exit(1)

    print("You won't need to confirm anything anymore...")
    print("Compiling MongoDB...")
    os.chdir("/home/pi/mongo-nonx86")