public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Harig, Mark A." <maharig@idirect.net>
To: "Buck Turgidson" <jc_va@hotmail.com>,
	"Eric De La Cruz Lugo" <eric_delacruz@yahoo.com>,
	<cygwin@cygwin.com>
Subject: RE: Cron Won't Run Jobs
Date: Fri, 06 Dec 2002 17:00:00 -0000	[thread overview]
Message-ID: <BADF3C947A1BD54FBA75C70C241B0B9E7630E0@ex02.idirect.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

Please try running the attached file (a bash shell script).
It attempts to diagnose problems in your directories and
crontab files.  It does *not* change any files, but tells
the user of any problems that it finds.  If it proves to
be useful, it could be donated to the Cygwin 'cron'
distribution.

[-- Attachment #2: cron_diagnose.sh --]
[-- Type: application/octet-stream, Size: 3602 bytes --]

#!/bin/bash
# ======================================================================
# $Source: $
# $Revision: $
# $Name: $
# $Date: $
# $State: $
# $Author: $
# ======================================================================

check_program()
{
	if [ `type $1 > /dev/null 2>&1` ]; then
		echo "The '$1' program is missing or not in your PATH."
		echo "This program is included in the '$2' package."
		echo "Please install this program and run this script again."
		return 1
	fi

	return 0
}

sanity_check()
{
	# Check for programs that this script uses.
	check_program ls fileutils || return 1
	check_program egrep grep || return 1
	check_program id sh-utils || return 1
	check_program cut textutils || return 1
	return 0
}

check_dir()
{
	if [ ! -d $1 ]; then
		echo "Your computer does not appear to have a $1 directory."
		echo "Please investigate this problem, and run this script again."
		return 1
	fi

	if [ `ls -ld $1 | egrep -q 'drwxrwxrxt'` ]; then
		echo "The permissions on the directory $1 are not correct."
		echo "Please run 'chmod 1777 $1', and run this script again."
		return 1
	fi

	return 0
}

check_cron_table()
{
	local user_id=$(id -un)
	local cron_table=/var/cron/tabs/$user_id

	if [ ! -f $cron_table ]; then
		echo "Your computer does not appear to have a crontab for $user_id."
		echo "Please generate a crontab for $user_id using 'crontab -e',"
		echo "and run this script again."
		return 1
	fi

	if [ `ls -l $cron_table|egrep -q 'rw-r-----'` ]; then
		echo "The permissions of your crontab file are set to:"
		ls -l $cron_table
		echo "They need to be set to read/write for $user_id and"
		echo "to read-only for group.  You can set these with"
		echo "	chmod 640 $cron_table"
		echo "Please check your crontab's permissions, and run"
		echo "this script again."
		return 1
	fi

	if [ `ls -l $cron_table|cut -d" " -f8|egrep -q SYSTEM` ]; then
		echo "The group membership of your crontab file should be SYSTEM,"
		echo "as documented in the file /usr/doc/Cygwin/cron.README."
		echo "You can change this setting with:"
		echo "	 chgrp SYSTEM $cron_table"
		echo "Please check your crontab's group membership, and"
		echo "run this script again."
		return 1
	fi

	if [ `ls -ln $cron_table|cut -d" " -f8|egrep -q 18` ]; then
		echo "The value of SYSTEM in your /etc/group file needs to"
		echo "be the reserved number '18', as documented in"
		echo "/usr/doc/Cygwin/cron.README.  Please investigate this"
		echo "and run this script again."
		return 1
	fi

	echo "No errors were found in your crontab setup by this script."
	echo "If you are still unable to get cron to work properly, then"
	echo "try shutting down the cron service, uninstalling it,"
	echo "reinstalling it, and restarting it."
	echo 
	echo "If you are still unable to get cron to run your crontab,"
	echo "then report your problem to cygwin@cygwin.com"
	echo "Please include a copy of your crontab ('crontab -l') and"
	echo "the output of 'cygcheck -srv > cygcheck.txt'.  cygcheck.txt"
	echo "should be included *as an attachment*, not in the body of"
	echo "mail message."

	return 0
}

main()
{
	sanity_check || return 1

	if [ ! -d /var ]; then
		echo "Your computer does not appear to have a /var directory."
		echo "Please investigate this problem, and run this script again."
		return 1
	fi

	check_dir /var/cron || return 1
	check_dir /var/cron/tabs || return 1
	check_cron_table || return 1

	return 0
}

# Entry point:
main
exit $?

# === End of $RCSfile$ === #

[-- Attachment #3: Type: text/plain, Size: 214 bytes --]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

             reply	other threads:[~2002-12-07  0:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-06 17:00 Harig, Mark A. [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-12-06 10:55 Harig, Mark A.
2002-12-06  8:21 Harig, Mark A.
2002-12-06 10:19 ` Buck Turgidson
2002-12-05  6:29 Vince Hoffman
2002-12-05  6:39 ` Buck Turgidson
2002-12-05  6:01 Buck Turgidson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BADF3C947A1BD54FBA75C70C241B0B9E7630E0@ex02.idirect.net \
    --to=maharig@idirect.net \
    --cc=cygwin@cygwin.com \
    --cc=eric_delacruz@yahoo.com \
    --cc=jc_va@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).