Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active February 21, 2020 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CMCDragonkai/8141efeefc1f5961d5b60e3aa2d886df to your computer and use it in GitHub Desktop.
Save CMCDragonkai/8141efeefc1f5961d5b60e3aa2d886df to your computer and use it in GitHub Desktop.
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.image-classifier;
script = ./test.py;
in
{
options.services.image-classifier.scheduler = {
enable = mkEnableOption "test";
};
config = lib.mkIf cfg.enable {
systemd.services.hello = {
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
RuntimeDirectory = "helloworld";
ExecStart = "${pkgs.python3}/bin/python -u ${script} $RUNTIME_DIRECTORY";
};
};
};
}
import sys
import os
import time
while True:
time.sleep(1)
print(sys.argv)
print("Hello World")
print(os.getcwd())
#print(os.listdir())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment