system("top") in a C program giving problems when the C prg is run by cron in Red hat linux 9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,

i have used something like
system("top -p 3211 -p 3232 -n 1 > log.txt ");
in my c program. The C prgm is running well when i run it from inside a terminal. 
I have included the executable of this c program in the crontab file for root.
But it is giving unknown TERM VT100 error then and top command is not run successfully, i.e, no output. So I set $TERM = vt100 and $TERMCAP= the termcap file for vt100
i tried setting $TERM = xterm and $TERM = linux with their corresponding values(paths of terminfo files) in $TERMCAP. But the tcgetattr() fn returned error. Now How can I get this program to work when its executed automatically by cron daemon. 

I tried using execl() instead of system() API   to execute the top command inside the C program. But I dont know how to write the  output of the thus executed top command to a file. Please let me know how to do this.

Please let me know the solution wither way.

Thanks and Regards
Raghu



		
---------------------------------
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux