Crontab command fail if user is not present in cron.allow file.
This moves away cron.allow and restores it afterward.

Signed-off-by: Gilles Carry <[email protected]>
---
 testcases/commands/cron/cron_pos_tests.sh |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/testcases/commands/cron/cron_pos_tests.sh 
b/testcases/commands/cron/cron_pos_tests.sh
index 87118e1..cc21bd3 100755
--- a/testcases/commands/cron/cron_pos_tests.sh
+++ b/testcases/commands/cron/cron_pos_tests.sh
@@ -4,6 +4,17 @@
 
 iam=`whoami`
 
+tvar=${MACHTYPE%-*}
+tvar=${tvar#*-}
+
+if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+then
+       CRON_ALLOW="/etc/cron.allow"
+else
+       CRON_ALLOW="/var/spool/cron/allow"
+fi
+
+
 if [ $iam = "root" ]; then
        if [ $# -lt 1 ] ; then
                echo Either do not run this script as root or start it like
@@ -11,7 +22,9 @@ if [ $iam = "root" ]; then
                exit 1
        fi
 
+       mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
        su $1 -c "$0 $*"
+       mv $CRON_ALLOW.old $CRON_ALLOW &> /dev/null
        exit $?
 fi
 
-- 
1.5.5.GIT


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to