#!/bin/sh #********************************************************************* # Copyright (c) International Business Machines Corp., 2000 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See # the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # FILE : cron02 # # PURPOSE: Test a postive cron job # - add new job # - check correct execution of job # - delete job # # HISTORY: # SUSE # TEST_USER="c01_user" TEST_USER_GROUP="users" TEST_USER_HOMEDIR="/home/$TEST_USER" #----------------------------------------------------------------------- # FUNCTION: do_setup #----------------------------------------------------------------------- do_setup(){ #erase any data from potential defunt cron test rm -rf /tmp/crontest > /dev/null 2>&1 #erase user if he may exist , so we can have a clean env rm -rf /home/$TEST_USER userdel $TEST_USER sleep 1 useradd -m -g $TEST_USER_GROUP $TEST_USER if [ $? != 0 ] then { echo "Could not add test user $TEST_USER to system $RHOST." exit 1 } fi if [ -n "$CROND_DAEMON" ]; then restart_daemon $CROND_DAEMON else tst_brkm TBROK "Couldn't find crond or cron" fi } #----------------------------------------------------------------------- # FUNCTION: do_cleanup #----------------------------------------------------------------------- do_cleanup(){ rm -rf /home/$TEST_USER userdel $TEST_USER } #----------------------------------------------------------------------- # FUNCTION: MAIN #----------------------------------------------------------------------- . cmdlib.sh do_setup cron_pos_tests.sh $TEST_USER EXIT_CODE=$? do_cleanup exit $EXIT_CODE