home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!news.bbn.com!usc!sdd.hp.com!hplabs!ucbvax!IMPAB.SE!mwk
- From: mwk@IMPAB.SE (Maria Waldemark)
- Newsgroups: comp.unix.programmer
- Subject: Exec a shell
- Message-ID: <m0mLVRr-00015oC@jocke.impab.se>
- Date: 21 Aug 92 17:38:27 GMT
- Sender: usenet@ucbvax.BERKELEY.EDU
- Lines: 52
-
-
- Hi,
-
- I want to run following command from a C-program by an exec call:
-
- >x.cmd param1 param2 ...
-
- Before x.cmd is executed I want to run the login shell.
-
- Everything works perfectly if I do as described below but it
- only works from one user.
-
- --------------------------------------------------------------------
-
- freopen("/dev/null", "r", stdin);
- freopen("/user/mwk/log", "a", stdout);
-
- arg[0] = "-";
- arg[1] = "-c";
- arg[2] = "/user/mwk/x.cmd param1 param2";
- arg[3] = NULL;
-
-
- ret = execve("/usr/bin/sh", arg, env);
-
-
- --------------------------------------------------------------------
-
- mwk 29596 1 0 10:36:34 ? 0:00 - -c /user/mwk/x.cmd parma1 param2
- mwk 29597 29596 0 10:36:34 ? 0:00 - -c /user/mwk/x.cmd param1 parma2
-
- --------------------------------------------------------------------
-
-
-
- I want to do the execve call from a daemon, which has no controlling
- terminal. The daemon never runs the script !!!
- In the logfile /user/mwk/log there is only some debug prints from
- the daemon.
-
-
- Can someone help me please ?
-
- /Maria
-
-
- --
-
- Maria Waldemark Tel: +46-8-6507525 Fax: +46-8-6502870
- IM Program AB Email : mwk@impab.se
- Fleminggatan 56
- S-112 45 Stockholm, Sweden
-