I have created a script to backup my server using flexbackup. Before I perform the backup I want to ensure that all the services are shutdown. I have written a script to do this...
Code:
#!/bin/bash
#
# Script to backup server using flexbackup
#
# Stop the services before backup
rcapache stop
rcfetchd stop
rcpostfix stop
rcgroupware stop
rcwebmail stop
rcldap stop
rccyrus stop
rcpostgresql stop
flexbackup -set SLOX
# Restart the services
rcpostgresql start
rccyrus start
rcldap start
rcwebmail start
rcgroupware start
rcpostfix start
rcfetchd start
rcapache start
This script works fine when I run it from a shell. However when I run it from a cron task under root I get the following messages emailed to me...
Quote:
/backup/flexrun.sh: line 7: rcapache: command not found
/backup/flexrun.sh: line 8: rcfetchd: command not found
/backup/flexrun.sh: line 9: rcpostfix: command not found
/backup/flexrun.sh: line 10: rcgroupware: command not found
/backup/flexrun.sh: line 11: rcwebmail: command not found
/backup/flexrun.sh: line 12: rcldap: command not found
/backup/flexrun.sh: line 13: rccyrus: command not found
/backup/flexrun.sh: line 14: rcpostgresql: command not found
/backup/flexrun.sh: line 19: rcpostgresql: command not found
/backup/flexrun.sh: line 20: rccyrus: command not found
/backup/flexrun.sh: line 21: rcldap: command not found
/backup/flexrun.sh: line 22: rcwebmail: command not found
/backup/flexrun.sh: line 23: rcgroupware: command not found
/backup/flexrun.sh: line 24: rcpostfix: command not found
/backup/flexrun.sh: line 25: rcfetchd: command not found
/backup/flexrun.sh: line 26: rcapache: command not found
|
The crontab is set as
Code:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.22064 installed on Fri Aug 20 15:10:04 2004)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
MAILTO="root"
12 15 * * * /backup/flexrun.sh
Obviously the crontab is running the script but why can't it find the commands? Do I need to specify a path?
Thanks