For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > August 2006 > shell script program refuse to take signal after it's started from cron









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author shell script program refuse to take signal after it's started from cron
cranfic

2006-08-22, 7:01 pm

I am sing for explaination and help desperately. I've never seen
this behavior before:

I have a control program which starts and shutdowns application, which
has a set of C programs and a script to check disk space. Recently I
added a shell script to reset the application every midnight from
crontab. In short, the reset script is a wrapper calling the control
program to shutdown and then start it again. After application
restarted, all the processes behaves fine functionally except when next
time I issue shutdown command from the command line the diskspace
script will hang. From the debug, I see the controling program keeps
calling kill_process to kill diskspace, but diskspace doesn't have
response at all. This is annoying. Any ideas?

By the way, if I start the reset script from command line the diskspace
will terminate all right.

Thank you for helping,
cran

Lew Pitcher

2006-08-23, 7:00 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


cranfic wrote:
> I am sing for explaination and help desperately. I've never seen
> this behavior before:
>
> I have a control program which starts and shutdowns application, which
> has a set of C programs and a script to check disk space. Recently I
> added a shell script to reset the application every midnight from
> crontab. In short, the reset script is a wrapper calling the control
> program to shutdown and then start it again. After application
> restarted, all the processes behaves fine functionally except when next
> time I issue shutdown command from the command line the diskspace
> script will hang. From the debug, I see the controling program keeps
> calling kill_process to kill diskspace, but diskspace doesn't have
> response at all. This is annoying. Any ideas?


What is the UID (both effective and real) that the cron'ed process
runs under?

What is the UID (both effective and real) of the process that sends the
kill signal?

IIRC, for a process to be able to kill another process, either the
killing process has to be root UID, or the killing process and the
process to be killed must have the same UID (either effective or real).

HTH
- --
Lew Pitcher

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32) - WinPT 0.11.12

iD8DBQFE7HgQagVFX4UWr64RAgfTAKCT4daUshHw
uWkNxRHztg3YeAeZLQCffjNd
i5KlNON5/fUrppBWBx05XMo=
=Zkpk
-----END PGP SIGNATURE-----

cranfic

2006-08-23, 7:00 pm

UID and RUID is the same whether it started from cron or command line.
Since I dotted in user's .profile

Lew Pitcher wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> cranfic wrote:
>
> What is the UID (both effective and real) that the cron'ed process
> runs under?
>
> What is the UID (both effective and real) of the process that sends the
> kill signal?
>
> IIRC, for a process to be able to kill another process, either the
> killing process has to be root UID, or the killing process and the
> process to be killed must have the same UID (either effective or real).
>
> HTH
> - --
> Lew Pitcher
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (MingW32) - WinPT 0.11.12
>
> iD8DBQFE7HgQagVFX4UWr64RAgfTAKCT4daUshHw
uWkNxRHztg3YeAeZLQCffjNd
> i5KlNON5/fUrppBWBx05XMo=
> =Zkpk
> -----END PGP SIGNATURE-----


Lew Pitcher

2006-08-23, 7:00 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


cranfic wrote:
> UID and RUID is the same whether it started from cron or command line.
> Since I dotted in user's .profile


I wouldn't think that just sourceing the user's profile would cause the
cronned process to acquire the user's UID. For that, cron would have to
perform a set[e]uid() call, independant of whatever you do with
..profile. All .profile would do is set environment variables and the
like to match the target user's preferences. I don't think that it has
anything to do with setting [e]uid.

Unless, you mean that you source /a/ profile, and since it sources the
target user's profile, you infer that the process acquired the target
user's UID as part of determining which .profile to source?

- --
Lew Pitcher

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32) - WinPT 0.11.12

iD8DBQFE7JBLagVFX4UWr64RApWOAKD2YISpPgCs
JTvTsGRDa8akbLgV5ACfXjs4
8hPn2DU7K7UyyNuC+/rUh8E=
=z/2w
-----END PGP SIGNATURE-----

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com