Quote:
Originally posted by DavidPhillips
should not be any reason to make a system wide crontab to run something a user wants to run. the crontab is stored according to username and written to the file
/var/spool/cron/username.
did you try to run the cron as the user?
|
Hmmm... Run cron as a user... Well I'd take this to mean that I created the cron job "AS" the user in question... If so, then, yes. I have a user (say "srv" as a username for example. He has rights to a directory in /home/srv that has a subtree that goes from that point. In that subtree you have a dir called /home/srv/app/subapp that has a script called ftplog.
I have a copy of ftplog called ftpchoice that only has one variant in it. Instead of doing some date parsing within the script it takes $1 and uses that instead of the calculated dateval.
This script looks like this:
#!/bin/bash
# HLDS_L Log File Uploader Script
# By Ding
# July 2, 2002
#
# Rev Comments
# A Initial Revision
#
prefix=L
datebod=`eval date +%m%d`
fnwc=*.log
fn=$prefix$datebod$fnwc
echo FTPing logfiles beginning with $fn
cd dod/logs
ncftpput -u srv -p itsnotforreal -a -E some.ip.com . $fn
echo The lion has left!
The crontab entry looks like this:
[srv@freya srv]$ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (doftplog installed on Thu Jul 4 08:57:35 2002)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
0 0 * * * /home/srv/app/subapp/ftplog
[srv@freya srv]$
This story get's weirder... I did a forklift upgrade to the server yesterday (which further increased my growing love of linux BTW!) I ripped out the old AMD Thunderbird 800MHz Proc and Mobo that was in it and replaced it with an AMD 2000XP on an MSI745 Ultra MB. The old Mobo had an ISA SB AWE64 that was removed as the new MOBO came with onboard sound. I am also using a MAXTOR PCI EIDE card as the primary controller. I had this on the old board and kept it on the new board to keep from having to play games with the boot loader and drive geometry. Oh, and it went from 384MB of older PC2100 SDRAM to 512MB PC2300 DDR as well!
So when I rebooted after the changes the server came right back up and KUDZU removed the SB AWE and other MOBO specific elements like the VIA USB and replaced it with the correct componets (GAWD! PnP worked right off! Like I said getting to love Linux more and more!) Logged into the user as srv and started the screened session of the application then logged off.
That night when the cron job was supposed to run I got an error instead that it could not find:
/home/srv/app/subapp/ftplog
I am going to check the crontab again. I swear right and left that this was running before the upgrade AND the only error I was getting was that it could not find any files that matched the file specification in the ftolog script... BUT the script was being fired at the right time!
VERY confusing!