From bc6b382058dd235baaa5612d7b7d324129a9a596 Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Mon, 11 Jan 2021 10:12:48 +0100 Subject: [PATCH] added deploy script cleanup function, first feature I wanted --- deploy.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..a78eee0 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +THIS="$(pwd)" + +_cleanup() { + echo -e "#!/usr/bin/env bash" >> /tmp/deploy_cleanup.sh + echo -e "rm -rf ${THIS}" >> /tmp/deploy_cleanup.sh + echo -e "crontab -l | sed '/# REF:deploy_cleanup:REF/Q' | crontab -" >> /tmp/deploy_cleanup.sh + chmod +x /tmp/deploy_cleanup.sh + echo -e "$(crontab -l)\n# REF:deploy_cleanup:REF\n* * * * *\t/tmp/deploy_cleanup.sh" | crontab - +}