aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/palhm/__main__.py (renamed from src/palhm.py)14
-rw-r--r--src/palhm/conf/crontab4
-rw-r--r--src/palhm/conf/palhm-boot-report.service2
3 files changed, 10 insertions, 10 deletions
diff --git a/src/palhm.py b/src/palhm/__main__.py
index b0ce2d4..cdb21b7 100755
--- a/src/palhm.py
+++ b/src/palhm/__main__.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3
# Copyright (c) 2022 David Timber <dxdt@dev.snart.me>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -41,7 +40,8 @@ class ProgConf:
ProgConf.ctx.l.setLevel(ProgConf.override_vl)
def err_unknown_cmd ():
- sys.stderr.write("Unknown command. Run '" + sys.argv[0] + " help' for usage.\n")
+ sys.stderr.write(
+ "Unknown command. Run '" + sys.executable + " -m palhm help' for usage.\n")
exit(2)
class Cmd (ABC):
@@ -60,7 +60,7 @@ class ConfigCmd (Cmd):
def print_help ():
print(
-"Usage: " + sys.argv[0] + " config" + '''
+"Usage: " + sys.executable + " -m palhm config" + '''
Load and parse config. Print the structure to stdout.''')
class RunCmd (Cmd):
@@ -82,7 +82,7 @@ class RunCmd (Cmd):
def print_help ():
print(
-"Usage: " + sys.argv[0] + " run [TASK]" + '''
+"Usage: " + sys.executable + " -m palhm run [TASK]" + '''
Run a task in config. Run the "''' + palhm.DEFAULT.RUN_TASK.value +
'''" task if [TASK] is not specified.''')
@@ -130,7 +130,7 @@ class ModsCmd (Cmd):
def print_help ():
print(
-"Usage: " + sys.argv[0] + " mods" + '''
+"Usage: " + sys.executable + " -m palhm mods" + '''
Prints the available modules to stdout.''')
class BootReportCmd (Cmd):
@@ -147,7 +147,7 @@ class BootReportCmd (Cmd):
def print_help ():
print(
-"Usage: " + sys.argv[0] + " boot-report" + '''
+"Usage: " + sys.executable + " -m palhm boot-report" + '''
Send mail of boot report to recipients configured.''')
class HelpCmd (Cmd):
@@ -168,7 +168,7 @@ class HelpCmd (Cmd):
def print_help ():
print(
-"Usage: " + sys.argv[0] + " [options] CMD [command options ...]" + '''
+"Usage: " + sys.executable + " -m palhm [options] CMD [command options ...]" + '''
Options:
-q Set the verbosity level to 0(CRITIAL). Overrides config
-v Increase the verbosity level by 1. Overrides config
diff --git a/src/palhm/conf/crontab b/src/palhm/conf/crontab
index d0eeda6..9e59a16 100644
--- a/src/palhm/conf/crontab
+++ b/src/palhm/conf/crontab
@@ -1,6 +1,6 @@
# PALHM will produce stderr on exception. Mail the output to root
MAILTO="root"
# Run default task every Sunday at midnight
-0 0 * * sun root /var/lib/PALHM/src/palhm.py -q run
+0 0 * * sun root python -m palhm -q run
# Check dnssec validity every hour
-# 0 * * * * root systemd-run -qP -p User=palhm -p Nice=15 -p ProtectSystem=strict -p ReadOnlyPaths=/ -p PrivateDevices=true --wait /var/lib/PALHM/src/palhm.py -q run check-dnssec
+# 0 * * * * root systemd-run -qP -p User=palhm -p Nice=15 -p ProtectSystem=strict -p ReadOnlyPaths=/ -p PrivateDevices=true --wait python -m palhm -q run check-dnssec
diff --git a/src/palhm/conf/palhm-boot-report.service b/src/palhm/conf/palhm-boot-report.service
index 0b4ba67..16a7c6d 100644
--- a/src/palhm/conf/palhm-boot-report.service
+++ b/src/palhm/conf/palhm-boot-report.service
@@ -4,7 +4,7 @@ After=postfix.service sendmail.service exim.service dovecot.service network-onli
[Service]
Type=oneshot
-ExecStart=/var/lib/PALHM/src/palhm.py -q boot-report
+ExecStart=/usr/bin/python -m palhm -q boot-report
Nice=10
[Install]