• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#*********************************************************************
3#   Copyright (c) International Business Machines  Corp., 2000
4#
5#   This program is free software;  you can redistribute it and/or modify
6#   it under the terms of the GNU General Public License as published by
7#   the Free Software Foundation; either version 2 of the License, or
8#   (at your option) any later version.
9#
10#   This program is distributed in the hope that it will be useful,
11#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13#   the GNU General Public License for more details.
14#
15#   You should have received a copy of the GNU General Public License
16#   along with this program;  if not, write to the Free Software
17#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18#
19#  FILE   : cron02
20#
21#  PURPOSE: Test a postive cron job
22#			- add new job
23#   		- check correct execution of job
24#   		- delete job
25#
26#  HISTORY:
27#     	SUSE
28#
29
30TEST_USER="c01_user"
31TEST_USER_GROUP="users"
32TEST_USER_HOMEDIR="/home/$TEST_USER"
33
34#-----------------------------------------------------------------------
35# FUNCTION:  do_setup
36#-----------------------------------------------------------------------
37
38do_setup(){
39	#erase any data from potential defunt cron test
40	rm -rf /tmp/crontest > /dev/null 2>&1
41
42    #erase user if he may exist , so we can have a clean env
43        rm -rf /home/$TEST_USER
44        userdel $TEST_USER
45	sleep 1
46
47        useradd -m -g $TEST_USER_GROUP $TEST_USER
48        if [ $? != 0 ]
49        then {
50                echo "Could not add test user $TEST_USER to system $RHOST."
51                exit 1
52        }
53        fi
54
55	if [ -n "$CROND_DAEMON" ]; then
56		restart_daemon $CROND_DAEMON
57	else
58		tst_brkm TBROK "Couldn't find crond or cron"
59	fi
60}
61
62#-----------------------------------------------------------------------
63# FUNCTION:  do_cleanup
64#-----------------------------------------------------------------------
65
66do_cleanup(){
67        rm -rf /home/$TEST_USER
68        userdel $TEST_USER
69}
70
71#-----------------------------------------------------------------------
72# FUNCTION:  MAIN
73#-----------------------------------------------------------------------
74. cmdlib.sh
75
76do_setup
77cron_pos_tests.sh $TEST_USER
78EXIT_CODE=$?
79do_cleanup
80exit $EXIT_CODE
81