[omd-commits] OMD Git: omd: crontab: check for root

git version control git at mathias-kettner.de
Thu Dec 23 17:38:31 CET 2010


Module: omd
Branch: master
Commit: d50aaf5b93558e374a552ef8b19bcb11240539cd
URL:    http://omdistro.org/projects/omd/repository/revisions/d50aaf5b93558e374a552ef8b19bcb11240539cd

Author: Joerg Linge <pitchfork at pnp4nagios.org>
Date:   Thu Dec 23 17:38:26 2010 +0100

crontab: check for root

---

 packages/maintenance/skel/etc/init.d/crontab |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/packages/maintenance/skel/etc/init.d/crontab b/packages/maintenance/skel/etc/init.d/crontab
index 419b991..a168ffe 100644
--- a/packages/maintenance/skel/etc/init.d/crontab
+++ b/packages/maintenance/skel/etc/init.d/crontab
@@ -12,6 +12,12 @@ CROND="###ROOT###/etc/cron.d/*"
 CRONTAB=`which crontab`          
 USER="###SITE###"
 
+# check for root
+if [ `id -u` -eq "0" ]; then
+        echo "This script will not run as root."
+        exit 1
+fi
+
 # See how we were called.
 case "$1" in
 



More information about the omd-commits mailing list