The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sunsolaris shell script runs only as super user gjithin SUN Solaris 4 05-09-2008 05:47 AM
How to use own account env variables to cron user Tlg13team HP-UX 3 01-28-2008 05:38 AM
SFTP errorcode 1 when run on cron but runs manually Heidi.Ebbs SUN Solaris 2 08-08-2007 09:16 AM
Old cron entry still runs, but shouldnt xadamz23 UNIX for Advanced & Expert Users 3 10-11-2005 02:11 PM
cron user finster UNIX for Dummies Questions & Answers 12 11-07-2004 08:24 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-22-2002
Registered User
 

Join Date: Aug 2001
Location: Raleigh, nC
Posts: 28
Stumble this Post!
What user runs cron?

I have a command that is found in /usr/ud51/bin called stopudt which safely stops idle database users (let's writes finish, etc).

If I login as root and issue stopudt [PID] the process is stopped.
I put a script in cron to run it and it says stopudt not found.

/usr/ud51/bin is in root's PATH. What other 'user' PATH do I need to modify... Or is that PATH the problem at all?

Thanks for any help!
Forum Sponsor
  #2 (permalink)  
Old 05-22-2002
auswipe's Avatar
Registered User
 

Join Date: Nov 2001
Location: Wide Awake Wylie, Texas
Posts: 536
Stumble this Post!
IIRC, cron jobs run under the users logon.

What OS are you running and how did you enter the command into crontab?

The reason I ask is that on one of my OpenBSD systems I use the `crontab -e` command to edit the crontab associated with the user that I am logged on as. This entry is saved in the /var/cron/tabs sub-dir under the users name to be read and executed from the cron daemon.

It sounds like your cron job is not executing as root and since the /usr/ud51/bin is in the root's path (and chances are, not in any of the other users path) it is being reported as not found.
__________________
Not quite as cool as all the other Kids...
  #3 (permalink)  
Old 05-22-2002
Kelam_Magnus's Avatar
Unix does a body good.
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Stumble this Post!
michieka,

If you could post part of your script, I think the problem is in there.

If you have ROOT, any script should run from there if it is in the PATH OR if you give the full path in cron or on the command line, which I always do to avoid problems with trojans and such.

I see that you have the PID number as well from the commandline "/usr/ud51/bin/stopudt. How do you capture that from a script?

Also, try creating a cron as that user. su - username then create a crontab as that user and execute it. See what you get from that.









__________________
My brain is your brain
  #4 (permalink)  
Old 05-22-2002
Registered User
 

Join Date: Mar 2002
Location: Minneapolis
Posts: 56
Stumble this Post!
Talking I run cron!

Quote:
Originally posted by michieka
What user runs cron?
I'm user chenly, and I run cron. I schedule ftp updates, web page modifications, everything... ;-)
__________________
% man woman
man: no entry for woman in the manual.
  #5 (permalink)  
Old 05-24-2002
Registered User
 

Join Date: Aug 2001
Location: Raleigh, nC
Posts: 28
Stumble this Post!
Running AIX 4.33. This is the script. I had to put some environment variables in there, but simply putting the PATH probably would have worked as well. Using sed and awk to get the PID numbers from who -u...

#!/usr/bin/ksh
#
# Logs users out that have been idle for 20 or more minutes.


UDTBIN=/usr/ud51/bin
UDTHOME=/usr/ud51

export UDTBIN
export UDTHOME


/usr/ud51/bin/stopudt `who -u | sed -e "s/\./0/" -e "s/://g" | awk '$6 > 20 {print $7}'`
  #6 (permalink)  
Old 05-24-2002
Registered User
 

Join Date: Aug 2001
Location: Raleigh, nC
Posts: 28
Stumble this Post!
Change default email for cron

How do I change who the default email goes to from cron jobs. I know it goes to the user by default. The man pages say I can use the mailto command, but I don't seem to have that on my system. AIX 4.33. How do you do it on yours?
  #7 (permalink)  
Old 05-24-2002
Kelam_Magnus's Avatar
Unix does a body good.
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Stumble this Post!
.forward email to root

You can redirect mail in a couple of ways. You can either use /etc/aliases for sendmail. or you can simply put a .forward in the user's home directory owned by root. Make the permissions 755.

/etc/aliases is a more efficient way to do it, but requires you to create a group and an alias name for the user. It works fine, but the simplest way is to use the .forward in that user home dir.
__________________
My brain is your brain
Google The UNIX and Linux Forums
Closed Thread

Tags
sendmail

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0