- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: question abt system command and exec command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2005 06:33 AM
03-21-2005 06:33 AM
question abt system command and exec command
exec command kicking two copies of script file .startup during initial login. Here is the setup of my login in the /etc/passwd file.
============================================================
userid:*:59190:501:rp*C,RP,XX,xXX:/home/user:/home/user/prog1
===========================================================
prog1 looks like following.
main()
{
execlp("./.startup",getlogin(), 0);
}
===============================================
/home/userid/.startup looks like following
settting some of the environments variables and kicking off prog2 binary.
/home/userid/prog2
==============================================
prog2 looks like following:
main()
{
system("/home/userid/prog3");
}
==============================================
The problem is prog2 is kicking off another copy of .startup file from prog1. I know system command is kickin off execl command. Is there any other c or system funciton i can use in prog2 so that it does not kick the .startup script again. Any answer would be appreciated. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2005 06:48 AM
03-21-2005 06:48 AM
Re: question abt system command and exec command
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2005 06:54 AM
03-21-2005 06:54 AM
Re: question abt system command and exec command
Due to some constraints, I need to do all this within the C program. Thanks.
Biren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2005 07:12 AM
03-21-2005 07:12 AM
Re: question abt system command and exec command
trying to solve, but it looks like you are making it
more complicated that it is. For ex:
> /home/userid/.startup looks like following
> settting some of the environments variables and
> kicking off prog2 binary.
> /home/userid/prog2
>
>prog2 looks like following:
>main()
> {
>system("/home/userid/prog3");
>}
1) Since prog2 just forks a shell and executes
prog3, why can't you change .startup to call prog3
instead of prog2 ?
2) Even better than #1 is, why can't you decide
what the value of env variables in prog1.c itself and
call system() or exec() to run prog3 with these env
variables. That way, all your code with be one C
program.
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2005 07:38 AM
03-21-2005 07:38 AM
Re: question abt system command and exec command
Ok prog2 needs to be root with sticky bit for setgid command to run successful. I can not give prog1 root ownership coz of security violation. That is why i am calling prog3 from prog2. Thanks.
Biren