diff options
author | Wojciech Kosior <kwojtus@protonmail.com> | 2020-06-04 20:41:50 +0200 |
---|---|---|
committer | Wojciech Kosior <kwojtus@protonmail.com> | 2020-06-04 20:41:50 +0200 |
commit | 3dbec14a792b2ea6d8f67a6090d57f0f1859e6d9 (patch) | |
tree | 9527df38ab3c86f12759a7781d6b777bbc168466 /uninstall.sh | |
parent | 5921557e322c0386ebc9a4ae00a9466c484eefb4 (diff) | |
download | 0tdns-3dbec14a792b2ea6d8f67a6090d57f0f1859e6d9.tar.gz 0tdns-3dbec14a792b2ea6d8f67a6090d57f0f1859e6d9.zip |
integrate with cron daemon
Diffstat (limited to 'uninstall.sh')
-rwxr-xr-x | uninstall.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/uninstall.sh b/uninstall.sh index 7c14cba..fee17b2 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,10 +1,23 @@ #!/bin/sh +# https://stackoverflow.com/questions/2990414/echo-that-outputs-to-stderr +errcho(){ >&2 echo "$@"; } + # run as root, obviously +if [ `id -u` != 0 ]; then + errcho "This script needs to be run as root" + exit 1 +fi # revert what was done in setup.sh userdel 0tdns +# remove our crontab entry marked with '<AUTO_GENERATED_0TDNS_ENTRY>' +# we also remove the 'DO NOT EDIT' header, as in setup.sh +crontab -l 2> /dev/null | + grep -vE '^# DO NOT EDIT THIS FILE|^# \(- installed on .*\)|^# \(Cron version .*\)' | + grep -v '<AUTO_GENERATED_0TDNS_ENTRY>' | crontab + # if told to - also revert what was done in install.sh if [ "x$1" = "x--delete-files" ]; then rm -r /var/lib/0tdns/ |