kmn@orstcs.UUCP (kmn) (09/20/85)
Has anyone experienced problems with the 'system()' call within a C program not being executed properly when the program is executed via cron? I have an Intel 286/310 XENIX system (but have also seen the problem on a VAX running 4.2). The problem is as follows: The C program contains a line such as.. system("/usr/lib/uucp/uucico -r1 -sxxxxxx"); The program executes correctly when executed in the csh, but if the program is executed via cron with 0 * * * * /usr/lib/uucp/program the system command is not executed. All other statements in the C program execute properly. I have had similar problems by doing the following test: create a shell containing: ps > /tmp/junk then execute the shell with cron by * * * * * csh shell The ps command never dumps to the file /tmp/junk. I suspect that the problem is in executing a new shell from within cron, and possibly due to the differences between sh and csh, but I haven't been able to figure it out (although, uucico executes properly from both sh and csh). Any answers would be greatly appreciated. Please respond to: Dave Wills Oregon State University ...hplabs!hp-pcd!osuee!dave
campbell@maynard.UUCP (Larry Campbell) (09/27/85)
> Has anyone experienced problems with the 'system()' call within a C > program not being executed properly when the program is executed via > cron? ... Your problem may be that in some Unix implementations, the first thing cron does is setuid(1); which means it (and its children) probably doesn't have permission to write in any log files you might be trying to use to leave tracks. I've found that removing the setuid makes cron much more useful. -- Larry Campbell decvax!genrad The Boston Software Works, Inc. \ 120 Fulton St. seismo!harvard!wjh12!maynard!campbell Boston MA 02109 / / ihnp4 cbosgd ARPA: campbell%maynard.uucp@harvard.arpa
seth@megad.UUCP (Seth H Zirin) (10/02/85)
> Has anyone experienced problems with the 'system()' call within a C > program not being executed properly when the program is executed via > cron? ..... > The C program contains a line such as.. > system("/usr/lib/uucp/uucico -r1 -sxxxxxx"); > > I have had similar problems by doing the following test: > create a shell containing: > ps > /tmp/junk > then execute the shell with cron by * * * * * csh shell > The ps command never dumps to the file /tmp/junk. Cron doesn't set up the environment completely enough for your commands to execute. The uucico command likes to have LOGNAME set appropriately, and "ps" probably would work a litte better if you used "ps -ef" or "ps -alx" (depending on the flavor Unix you use). Its common practice to call commands with an "su" from cron: 30 5 * * 1 /bin/su uucp -c "/usr/lib/uucp/uudemon.wk > /dev/null" -- ------------------------------------------------------------------------------- Name: Seth H Zirin UUCP: {decvax, ihnp4}!philabs!sbcs!megad!seth Keeper of the News for megad
wombat@ccvaxa.UUCP (10/10/85)
Maybe System V uucico likes to have LOGNAME set, but it isn't a standard envirnoment variable at all in 4.2. "When you are about to die, a wombat is better than no company at all." Roger Zelazny, *Doorways in the Sand* Wombat ihnp4!uiucdcs!ccvaxa!wombat