Running C programs with cron ???

Seth H Zirin seth at megad.UUCP
Wed Oct 2 23:57:22 AEST 1985


> 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



More information about the Comp.unix.wizards mailing list